|
Jumpi v1.2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Controller manages all communications operations between a Jumpi instance and protocol specific Connectors, to provide communication guarantees. A Controller can provide communications guarantees like reliability and ordering above unreliable, non order preserving Connectors. Controllers are protocol independent since they and do not directly perform any low level communications themselves. All communications operations are performed via Connectors which are protocol specific communication adapters.
The following are examples of possible Controllers:
When a Jumpi client application requests a Destination from a Jumpi instance
with Jumpi.getDestination(java.lang.String, java.lang.String, java.util.Hashtable)
, the Jumpi instance delegates
the request to the associated Controller or to the default Controller. The
Controller must return a Destination instance associated with the provided
Destination Url if the Destination Url can be handled by the Controller.
Once the link is associated with the Destination, send and receive
operations can be requested for the Destination.
A Jumpi.send(org.jumpi.Destination, java.lang.Object, org.jumpi.Selector, java.util.Hashtable)
operation is delegated by the Jumpi instance
to the Controller responsible for the send's Destination. The Controller
returns a Handle back to the Jumpi instance which is given to the Jumpi
client application and handles the sending operation in its own
implementation dependent way using any configured Connectors. The send
operation may or may not block. This is implementation dependent. Blocking
send operations only return the Handle to the caller when the send
operation is completed, either successfully or failed. Non blocking send
operations may or may not have completed before the Handle is returned to
the caller.
A Jumpi.recv(org.jumpi.Destination, org.jumpi.Selector, java.util.Hashtable)
operation is delegated by the Jumpi instance
to the Controller responsible for the receive's Destination. The Controller
returns a Handle back to the Jumpi instance which is given to the Jumpi
client application and handles the receiving operation in its own
implementation dependent way using any configured Connectors. The receive
operation may or may not block. This is implementation dependent. Blocking
receive operations only return the Handle to the caller when the receive
operation is completed, either successfully or failed. Non blocking
receive operations may or may not have completed before the Handle is
returned to the caller.
Controllers may or may not be tightly linked to individual Connectors, since Connector behavior may be very different. For example blocking behaviour and concurrency of send or receive operations is implementation dependent. A Controller may only function correctly for non blocking Connectors. The Controller must make sure that an operation's Envelope has a correct message data contained in the context stack, for the Connector. The Controller may require certain message data formats from a Jumpi client application in order to be able to fullfill its contract with the Connectors. The compatibility between Controller and Connector must be explicity defined.
Method Summary | |
void |
callbackRecv(Envelope env,
boolean success,
java.lang.String status)
Callback called by Connector to signal completion of a Connector receive operation. |
void |
callbackSend(Envelope env,
boolean success,
java.lang.String status)
Callback called by Connector to signal completion of a Connector send operation. |
void |
cancelRecv(Destination dest,
Handle hdl)
Cancel a receive operation. |
void |
cancelSend(Destination dest,
Handle hdl)
Cancel a send operation. |
Destination |
getDestination(java.lang.String url,
java.util.Hashtable clientProps)
Get the Destination associated with the Destination Url. |
Handle |
recv(Destination dest,
java.util.Hashtable clientProps)
Receive a message from the Destination. |
Handle |
send(Destination dest,
java.lang.Object msg,
java.util.Hashtable clientProps)
Send the message to the Destination. |
Methods inherited from interface org.jumpi.spi.Configurable |
configure, getName |
Methods inherited from interface org.jumpi.spi.Manageable |
manage |
Method Detail |
public Destination getDestination(java.lang.String url, java.util.Hashtable clientProps)
url
- the Destination Url.clientProps
- read-only properties for implementation specific use.
java.lang.IllegalArgumentException
- when url is null.Connector.getDestination(java.lang.String, java.util.Hashtable)
public Handle send(Destination dest, java.lang.Object msg, java.util.Hashtable clientProps)
Send the message to the Destination. The read-only properties are for implementation specific use. Send operations are delegated to Connectors. There is not a 1:1 relationship between calls to send and those passed down to the Connector layer. This is implementation dependent.
The message format required on entry is implementation dependent. The
Controller is responsible for satisfying the Connector.send(org.jumpi.spi.Envelope)
requirements.
Message delivery guarantees are implementation dependent. The send method may block. This is implementation specific. So too is the concurrency behaviorof the Controller. A Controller may be able to handle multiple concurrent sends, but need not.
dest
- the Destination to which the msg is to be sent.msg
- the message.clientProps
- read-only properties for implementation specific use.
java.lang.IllegalArgumentException
- when dest is null.Connector.send(org.jumpi.spi.Envelope)
public Handle recv(Destination dest, java.util.Hashtable clientProps)
Receive a message from the Destination. The read-only properties are for implementation specific use. Receive operations are delegated to Connectors. There is not a 1:1 relationship between calls to recv and those passed down to the Connector layer. This is implementation dependent.
The message format required on entry is implementation dependent. The Controller is responsible for reading the received message from the Connector specific data provided in the callbackRecv's Envelope, and providing the message ultimately in a well defined format for the Jumpi client application.
The recv method may block. This is implementation specific. So too is the concurrency behaviorof the Controller. A Controller may be able to handle multiple concurrent receives, but need not.
On completion of the receive operation, the Controller must make sure
that the Jumpi client guarantee for the associated Handle is upheld.
The received message must be availbile throught Handle.getMessage()
and the sender is through Handle.getSender()
.
dest
- the Destination from which to receive a message.clientProps
- read-only properties for implementation specific use.
java.lang.IllegalArgumentException
- when dest is null.Connector.recv(org.jumpi.spi.Envelope)
public void cancelSend(Destination dest, Handle hdl)
Cancel a send operation. Jumpi client applications use Handle.cancel()
to cancel asynchronous send and receive
operations. Each Handle is linked to the Controller which instantiated
it and is linked to a Destination for the operation. The cancellation
of a Handle is delegated to the responsible Connector, in the case of a
send operation to cancelSend. The cancel method must never
block.
The Controller can free resources and delegate the cancel to the Connector layer so that low level resources can be freed, for operations which are not needed anymore.
dest
- the Destination of the send operation associated to hdl.hdl
- the Handle associated with the send operation to cancel.
java.lang.IllegalArgumentException
- when dest or hdl is null.Connector.cancelSend(org.jumpi.spi.Envelope)
public void cancelRecv(Destination dest, Handle hdl)
Cancel a receive operation. Jumpi client applications use Handle.cancel()
to cancel asynchronous send and receive
operations. Each Handle is linked to the Controller which instantiated
it and is linked to a Destination for the operation. The cancellation
of a Handle is delegated to the responsible Connector, in the case of a
receive operation to cancelRecv. The cancel method must never
block.
The Controller can free resources and delegate the cancel to the Connector layer so that low level resources can be freed, for operations which are not needed anymore.
dest
- the Destination of the receive operation associated to hdl.hdl
- the Handle associated with the receive operation to cancel.
java.lang.IllegalArgumentException
- when dest or hdl is null.Connector.cancelRecv(org.jumpi.spi.Envelope)
public void callbackSend(Envelope env, boolean success, java.lang.String status)
env
- the Envelope used in Connector.sendsuccess
- true if successfully sent or false if a failure ocured.status
- a message giving more information to the status.
java.lang.IllegalArgumentException
- when env is null.Connector.send(org.jumpi.spi.Envelope)
public void callbackRecv(Envelope env, boolean success, java.lang.String status)
Callback called by Connector to signal completion of a Connector receive operation. The success status and status message are provided by the Connector. A Connector will always call callbackRecv after completion unless a cancel has been performed for the Envelope at the Connector. Due to multithreading and synchronization, a Controller can expect callbackRecv to be called whilst calling Connector.cancelRecv.
If successfully completed, the Envelope must contain the message data on
the Envelope's context stack with Envelope.popContext()
, and the
sender must be available with Envelope.getSender()
env
- the Envelope used in Connector.recvsuccess
- true if successfully received or false if a failure
ocured.status
- a message giving more information to the status.
java.lang.IllegalArgumentException
- when env is null.Connector.recv(org.jumpi.spi.Envelope)
|
Jumpi v1.2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |