|
Jumpi v1.2.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.jumpi.impl.HandleImpl
An Handle carries status information about pending or finished send and receive operations. It allows inquiry of the state information and received messages and the sender. Handles can be used to for synchronization, when a Jumpi client application wants to wait for pending operations to complete before continuing.
| Field Summary |
| Fields inherited from interface org.jumpi.spi.Status |
STATUS_RECEIVING, STATUS_SENDING |
| Fields inherited from interface org.jumpi.Status |
STATUS_CANCELLED, STATUS_FAILURE, STATUS_SUCCESS, STATUS_TRANSIENT |
| Constructor Summary | |
HandleImpl(int status,
java.lang.Object msg,
Destination dest,
Controller controller,
boolean send)
Creates a new HandleImpl object. |
|
HandleImpl(int status,
java.lang.String statusMessage,
boolean send)
Creates a new HandleImpl object. |
|
HandleImpl(int status,
java.lang.String statusMessage,
java.lang.Object msg,
Destination dest,
Controller controller,
boolean send)
Creates a new HandleImpl object. |
|
| Method Summary | |
void |
addSelector(Selector selector)
Add the Selector to the list of Selectors to which the Handle belongs. |
void |
assertStatusCode(int status,
java.lang.String errorMessage)
Throw an Exception with the provided error message if the status code does not match the provided value. |
void |
cancel()
Immediately cancel the send or receive operation associated with the Handle. |
static Handle |
createFailedHandle(java.lang.String statusMsg,
boolean send)
Create a failed, non blocking Handle given a status message and whether the Handle is a send or receive Handle. |
static Handle |
createTransientHandle(Destination dest,
java.util.Hashtable clientProps,
Controller controller,
boolean send)
Create a transient send or receive Handle belonging to a Controller, addressed to a Destination with optional client properties. |
static Handle |
createTransientHandle(java.lang.Object msg,
Destination dest,
java.util.Hashtable clientProps,
Controller controller,
boolean send)
Create a transient send or receive Handle belonging to a Controller, addressed to a Destination with optional message and client properties. |
void |
ensureProperties()
Ensure that there is a Hashtable for implementation specific Properties which will be returned to a Jumpi client application with getProperties(). |
java.util.Hashtable |
getClientProperties()
Returns the read-only client properties as used in Jumpi.send() or Jumpi.recv() when blocking, otherwise null. |
Controller |
getController()
Get the Controller instance responsible for the Handle. |
Destination |
getDestination()
Gets the Destination to which a message is being sent or being received from. |
java.lang.Object |
getMessage()
Return the message being sent or which has been received. |
java.util.Hashtable |
getProperties()
Returns additional information concerning the send or receive operation to the Jumpi client application. |
Destination |
getSender()
Get the Destination representation of the sender of a received message. |
int |
getStatus()
Get the internal status code of the Handle. |
int |
getStatusCode()
Returns the current Status of the Handle. |
java.lang.String |
getStatusMessage()
Return the current status message. |
boolean |
isBlocking()
Returns true when the Handle's status is blocking, that is, getStatusCode() returns STATUS_TRANSIENT, otherwise false. |
boolean |
isNonBlocking()
Returns true when the Handle's status is non blocking, that is, getStatusCode() does NOT return STATUS_TRANSIENT, otherwise false. |
boolean |
isRecvHandle()
Whether the Handle is associated with a receive operation or not. |
boolean |
isSendHandle()
Whether the Handle is associated with a send operation or not. |
void |
removeProperties()
Ensure that there are no implementation specific Properties which will be returned to a Jumpi client application with getProperties(). |
void |
removeSelector(Selector selector)
Remove the Selector from the list of Selectors to which the Handle belongs. |
void |
setClientProperties(java.util.Hashtable props)
Sets the read-only client properties as used in Jumpi.send() or Jumpi.recv(). |
void |
setController(Controller controller)
Set the Controller instance responsible for the Handle. |
void |
setDestination(Destination dest)
Sets the Destination to which a message is being sent or being received from. |
void |
setMessage(java.lang.Object msg)
Set the message being sent or which has been received. |
void |
setSender(Destination sender)
Set the Destination which represents the sender of a received message. |
void |
setStatus(int status)
Set the status of the Handle and a status message. |
void |
setStatus(int status,
java.lang.Object msg)
Set the status of the Handle and a message received. |
void |
setStatus(int status,
java.lang.String statusMessage)
Set the status of the Handle and a status message. |
void |
setStatus(int status,
java.lang.String statusMessage,
java.lang.Object msg)
Set the status of the Handle and a message and status message. |
void |
setStatusMessage(java.lang.String statusMessage)
Set the current status message. |
void |
waitWhileBlocking()
Wait for an unlimited time until the status of the Handle becomes non blocking. |
void |
waitWhileBlocking(long timeout)
Wait for a limited time until the status of the Handle becomes non blocking. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public HandleImpl(int status,
java.lang.Object msg,
Destination dest,
Controller controller,
boolean send)
status - the current state of the Handle.msg - the message being sent or received.dest - the Destination to which the message is sent or received
from.controller - the controller responsible for the operation.send - whether the operation is a send or receive operation.
public HandleImpl(int status,
java.lang.String statusMessage,
boolean send)
status - the current state of the Handle.statusMessage - the current status message.send - whether the operation is a send or receive operation.
public HandleImpl(int status,
java.lang.String statusMessage,
java.lang.Object msg,
Destination dest,
Controller controller,
boolean send)
status - the current state of the Handle.statusMessage - the current status message.msg - the message to be sent or the message received.dest - the Destination to send the message to or to receive from.controller - the responsible Controller.send - true if associated with a send operation, else false.| Method Detail |
public void addSelector(Selector selector)
addSelector in interface Handleselector - the Selector to which this instance belongs.
java.lang.IllegalArgumentException - if selector is null.Selector.addHandle(org.jumpi.Handle)public void removeSelector(Selector selector)
removeSelector in interface Handleselector - the Selector to which this instance no longer belongs.
java.lang.IllegalArgumentException - if selector is null.Selector.clear(),
Selector.removeHandle(org.jumpi.Handle)
public static Handle createFailedHandle(java.lang.String statusMsg,
boolean send)
statusMsg - the failure status message.send - true if the Handle is a sendHandle, otherwise false.
public static Handle createTransientHandle(java.lang.Object msg,
Destination dest,
java.util.Hashtable clientProps,
Controller controller,
boolean send)
msg - the message to send or the received message.dest - the Destination to send the message to or receive the
message from.clientProps - optional read-only client customization properties.controller - the Controller responsible for the Handle.send - true if the Handle is a sendHandle, otherwise false.
public static Handle createTransientHandle(Destination dest,
java.util.Hashtable clientProps,
Controller controller,
boolean send)
dest - the Destination to send the message to or receive the
message from.clientProps - optional read-only client customization properties.controller - the Controller responsible for the Handle.send - true if the Handle is a sendHandle, otherwise false.
public int getStatusCode()
getStatusCode in interface HandleStatuspublic int getStatus()
getStatus in interface HandlesetStatus(int)public void setStatus(int status)
Selector.handleStatusChanged(org.jumpi.spi.Handle) method is called.
setStatus in interface Handlestatus - the internal status of the Handle.getStatus(),
setStatus(int),
Selector.handleStatusChanged(org.jumpi.spi.Handle)
public void setStatus(int status,
java.lang.String statusMessage)
Selector.handleStatusChanged(org.jumpi.spi.Handle) method must be called.
setStatus in interface Handlestatus - the internal status of the Handle.statusMessage - the internal status message of the Handle.getStatus(),
setStatus(int),
Selector.handleStatusChanged(org.jumpi.spi.Handle)
public void setStatus(int status,
java.lang.Object msg)
Selector.handleStatusChanged(org.jumpi.spi.Handle) method must be called.
status - the internal status of the Handle.msg - the message to be sent or received.getStatus(),
setStatus(int),
Selector.handleStatusChanged(org.jumpi.spi.Handle)
public void setStatus(int status,
java.lang.String statusMessage,
java.lang.Object msg)
Selector.handleStatusChanged(org.jumpi.spi.Handle) method must be called.
status - the internal status of the Handle.statusMessage - the internal status message of the Handle.msg - the message to be sent or received.getStatus(),
setStatus(int),
Selector.handleStatusChanged(org.jumpi.spi.Handle)public java.lang.String getStatusMessage()
getStatusMessage in interface HandlesetStatusMessage(java.lang.String),
setStatus(int,String,Object)public void setStatusMessage(java.lang.String statusMessage)
setStatusMessage in interface HandlestatusMessage - the current status message.getStatusMessage()public boolean isNonBlocking()
isNonBlocking in interface Handlepublic boolean isBlocking()
isBlocking in interface Handlepublic java.lang.Object getMessage()
getMessage in interface HandlesetMessage(java.lang.Object),
setStatus(int,Object)public void setMessage(java.lang.Object msg)
setMessage in interface Handlemsg - the message being sent or which has been received.getMessage()public Destination getDestination()
getDestination in interface HandlesetDestination(org.jumpi.spi.Destination)public void setDestination(Destination dest)
setDestination in interface Handledest - the Destination to which a message is being sent or being
received from.getDestination()public Destination getSender()
getSender in interface HandlesetSender(org.jumpi.spi.Destination)public void setSender(Destination sender)
setSender in interface Handlesender - the Destination representing the sender of a received
message.getSender()public java.util.Hashtable getProperties()
getProperties in interface HandleensureProperties(),
removeProperties()public void ensureProperties()
ensureProperties in interface HandlegetProperties(),
removeProperties()public void removeProperties()
removeProperties in interface HandlegetProperties(),
ensureProperties()public void setClientProperties(java.util.Hashtable props)
setClientProperties in interface Handleprops - the read-only client properties.getClientProperties(),
Jumpi.send(org.jumpi.Destination, java.lang.Object, org.jumpi.Selector, java.util.Hashtable),
Jumpi.recv(org.jumpi.Destination, org.jumpi.Selector, java.util.Hashtable)public java.util.Hashtable getClientProperties()
getClientProperties in interface HandlesetClientProperties(java.util.Hashtable),
Jumpi.send(org.jumpi.Destination, java.lang.Object, org.jumpi.Selector, java.util.Hashtable),
Jumpi.recv(org.jumpi.Destination, org.jumpi.Selector, java.util.Hashtable)public void cancel()
cancel in interface HandleController.cancelSend(org.jumpi.spi.Destination, org.jumpi.spi.Handle),
Controller.cancelRecv(org.jumpi.spi.Destination, org.jumpi.spi.Handle)public void waitWhileBlocking()
waitWhileBlocking in interface Handlepublic void waitWhileBlocking(long timeout)
waitWhileBlocking in interface Handletimeout - maximum waiting time in milliseconds before returning if
the status does not change to non blocking.public boolean isSendHandle()
isSendHandle in interface HandleisRecvHandle()public boolean isRecvHandle()
isRecvHandle in interface HandleisSendHandle()public void setController(Controller controller)
setController in interface Handlecontroller - the responsible Controller.Handle.cancel(),
getController()public Controller getController()
getController in interface HandlesetController(org.jumpi.spi.component.Controller)
public void assertStatusCode(int status,
java.lang.String errorMessage)
throws java.lang.Exception
assertStatusCode in interface Handlestatus - the Status code required for return without throwing an
Exception.errorMessage - the error message to use in the Exception thrown if
any.
java.lang.Exception - if status != getStatusMessage.
|
Jumpi v1.2.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||