Class JeroMQAsyncOperation
java.lang.Object
dev.getelements.elements.rt.remote.jeromq.JeroMQAsyncOperation
- All Implemented Interfaces:
AsyncOperation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static enum
-
Field Summary
Fields inherited from interface dev.getelements.elements.rt.remote.AsyncOperation
DEFAULT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacquire
(AsyncConnection<org.zeromq.ZContext, org.zeromq.ZMQ.Socket> connection) Called when the connection is acquired.void
cancel()
Cancels the invocation.finish()
Finishes the operation and returns the underlying connection to the pool.Finishes the cancellation.Attempts to finish the operation by setting the state toJeroMQAsyncOperation.State.FINISH_PENDING
.void
Sets the operation to automatically cancel after the supplied time has elapsed.toString()
-
Constructor Details
-
JeroMQAsyncOperation
public JeroMQAsyncOperation()
-
-
Method Details
-
cancel
public void cancel()Description copied from interface:AsyncOperation
Cancels the invocation.- Specified by:
cancel
in interfaceAsyncOperation
-
timeout
Description copied from interface:AsyncOperation
Sets the operation to automatically cancel after the supplied time has elapsed.- Specified by:
timeout
in interfaceAsyncOperation
- Parameters:
time
- the time to waittimeUnit
- the time unit to wait
-
finishCancellation
Finishes the cancellation.- Returns:
- finished
-
acquire
public JeroMQAsyncOperation.ConnectionState acquire(AsyncConnection<org.zeromq.ZContext, org.zeromq.ZMQ.Socket> connection) Called when the connection is acquired. If the operation is still in a suitable state, this will return true incicating that the operation may proceed. This is only valid if the current state isJeroMQAsyncOperation.State.CONNECTION_PENDING
. For any other state, this will return false indicating that the connection has already finished or is in the process of being canceled.- Returns:
- true if the operation may proceed.
-
requestFinish
Attempts to finish the operation by setting the state toJeroMQAsyncOperation.State.FINISH_PENDING
. This indicates that the response is ready and the response w ill be written shortly. If this transition is successful, then a subsequent call tofinish()
must happen to ensure the connection is properly recycled. -
finish
Finishes the operation and returns the underlying connection to the pool.- Returns:
- the current
JeroMQAsyncOperation.ConnectionState
-
toString
-