public class CmdCallbackI extends _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 HandlePrx |
handle
Proxy passed to this instance on creation.
|
__ids
ice_staticId
Constructor and Description |
---|
CmdCallbackI(client client,
HandlePrx handle) |
CmdCallbackI(CmdCallbackI ccb) |
CmdCallbackI(Ice.ObjectAdapter adapter,
java.lang.String category,
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(Response rsp,
Status status,
Ice.Current __current)
Called when the command has completed.
|
Response |
getResponse()
Returns possibly null Response value.
|
Status |
getStatus()
Returns possibly null Status value.
|
protected 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.
|
Response |
loop(int loops,
long ms)
Calls block(long) "loops" number of times with the "ms"
argument.
|
void |
onFinished(Response rsp,
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, __read, __read, __readImpl, __write, __write, __writeImpl, clone, ice_dispatch, ice_dispatch, ice_operationAttributes, ice_ping, ice_ping, ice_postUnmarshal, ice_preMarshal
protected final HandlePrx handle
public CmdCallbackI(client client, HandlePrx handle) throws ServerError
ServerError
public CmdCallbackI(CmdCallbackI ccb) throws ServerError
ServerError
public CmdCallbackI(Ice.ObjectAdapter adapter, java.lang.String category, HandlePrx handle) throws ServerError
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 Response getResponse()
null
public Status getStatus()
null
protected Status getStatusOrThrow()
public boolean isCancelled()
State.CANCELLED
has been flaggedpublic boolean isFailure()
State.FAILURE
has been flaggedpublic Response loop(int loops, long ms) throws java.lang.InterruptedException, LockTimeout
loops
- Number of times to call block(long)ms
- Number of milliseconds to pass to block(longjava.lang.InterruptedException
- if the thread was interruptedLockTimeout
- if block(long) does not return
a non-null value after loops calls.public boolean block(long ms) throws java.lang.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.java.lang.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)
__current
- The Current object for the invocation.public final void finished(Response rsp, Status status, Ice.Current __current)
__current
- The Current object for the invocation.public void onFinished(Response rsp, 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