public class CmdCallbackI
extends omero.cmd._CmdCallbackDisp
cb = new CmdCallbackI(client, handle); response = null; while (response == null) { response = cb.block(500); } // or response = cb.loop(5, 500);Subclasses which depend on the proper ordering of either initialization or calls to
onFinished(Response, Status, Current)
should make
use of the initializationDone()
and waitOnInitialization()
,
or the onFinishedDone()
and waitOnFinishedDone()
methods.initializationDone()
,
onFinishedDone()
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected omero.cmd.HandlePrx |
handle
Proxy passed to this instance on creation.
|
Constructor and Description |
---|
CmdCallbackI(client client,
omero.cmd.HandlePrx handle) |
CmdCallbackI(CmdCallbackI ccb) |
CmdCallbackI(Ice.ObjectAdapter adapter,
String category,
omero.cmd.HandlePrx handle) |
Modifier and Type | Method and Description |
---|---|
boolean |
block(long ms)
Blocks for the given number of milliseconds unless
finished(Response, Status, Current) has been called in which case
it returns immediately with true. |
void |
close(boolean closeHandle)
First removes self from the adapter so as to no longer receive
notifications, and the calls close on the remote handle if requested.
|
void |
finished(omero.cmd.Response rsp,
omero.cmd.Status status,
Ice.Current __current)
Called when the command has completed.
|
omero.cmd.Response |
getResponse()
Returns possibly null Response value.
|
omero.cmd.Status |
getStatus()
Returns possibly null Status value.
|
protected omero.cmd.Status |
getStatusOrThrow() |
protected void |
initializationDone()
Subclasses which must perform their own initialization before
onFinished(Response, Status, Current) is called should
call initializationDone() once that setup is complete. |
protected void |
initialPoll()
Called at the end of construction to check a race condition.
|
boolean |
isCancelled()
Returns whether Status::CANCELLED is contained in
the flags variable of the Status instance.
|
boolean |
isFailure()
Returns whether Status::FAILURE is contained in
the flags variable of the Status instance.
|
omero.cmd.Response |
loop(int loops,
long ms)
Calls block(long) "loops" number of times with the "ms"
argument.
|
void |
onFinished(omero.cmd.Response rsp,
omero.cmd.Status status,
Ice.Current __current)
Method intended to be overridden by subclasses.
|
protected void |
onFinishedDone() |
void |
poll()
Calls
HandlePrx.getResponse() in order to check for a non-null
value. |
void |
step(int complete,
int total,
Ice.Current __current)
Called periodically by the server to signal that processing is
moving forward.
|
protected void |
waitOnFinishedDone() |
protected void |
waitOnInitialization()
Subclasses which must perform their own initialization before
onFinished(Response, Status, Current) is called should
call waitOnInitialization() before accessing any initialized
state. |
___finished, ___step, __dispatch, __readImpl, __writeImpl, finished, ice_copyStateFrom, ice_id, ice_id, ice_ids, ice_ids, ice_isA, ice_isA, ice_staticId, step
___ice_id, ___ice_ids, ___ice_isA, ___ice_ping, __checkMode, __collocDispatch, __read, __read, __readImpl, __write, __write, __writeImpl, clone, ice_dispatch, ice_dispatch, ice_operationAttributes, ice_ping, ice_ping, ice_postUnmarshal, ice_preMarshal
protected final omero.cmd.HandlePrx handle
public CmdCallbackI(client client, omero.cmd.HandlePrx handle) throws omero.ServerError
omero.ServerError
public CmdCallbackI(CmdCallbackI ccb) throws omero.ServerError
omero.ServerError
public CmdCallbackI(Ice.ObjectAdapter adapter, String category, omero.cmd.HandlePrx handle) throws omero.ServerError
omero.ServerError
protected void initialPoll()
HandlePrx
finishes its execution before the
CmdCallbackPrx
has been sent set via addCallback,
then there's a chance that this implementation will never
receive a call to finished, leading to perceived hangs.
By default, this method starts a background thread and
calls poll()
. An ObjectNotExistException
implies that another caller has already closed the
HandlePrx
.protected void initializationDone()
onFinished(Response, Status, Current)
is called should
call initializationDone()
once that setup is complete.protected void waitOnInitialization()
onFinished(Response, Status, Current)
is called should
call waitOnInitialization()
before accessing any initialized
state.protected void onFinishedDone()
protected void waitOnFinishedDone()
public omero.cmd.Response getResponse()
null
public omero.cmd.Status getStatus()
null
protected omero.cmd.Status getStatusOrThrow()
public boolean isCancelled()
State.CANCELLED
has been flaggedpublic boolean isFailure()
State.FAILURE
has been flaggedpublic omero.cmd.Response loop(int loops, long ms) throws InterruptedException, omero.LockTimeout
loops
- Number of times to call block(long)ms
- Number of milliseconds to pass to block(longInterruptedException
- if the thread was interruptedomero.LockTimeout
- if block(long) does not return
a non-null value after loops calls.public boolean block(long ms) throws InterruptedException
finished(Response, Status, Current)
has been called in which case
it returns immediately with true. If false is returned, then the timeout
was reached.ms
- Milliseconds which this method should block for.InterruptedException
- if the thread was interruptedpublic void poll()
HandlePrx.getResponse()
in order to check for a non-null
value. If so, _HandleOperations.getStatus(Ice.Current)
is also called, and the two
non-null values are passed to
finished(Response, Status, Current)
. This should typically
not be used. Instead, favor the use of block and loop.public void step(int complete, int total, Ice.Current __current)
public final void finished(omero.cmd.Response rsp, omero.cmd.Status status, Ice.Current __current)
public void onFinished(omero.cmd.Response rsp, omero.cmd.Status status, Ice.Current __current)
rsp
- the responsestatus
- the status__current
- regarding the current method invocationpublic void close(boolean closeHandle)
closeHandle
- if the handle should be closed
Version: 5.3.5-ice35-b73
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.