|
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.AbstractController | +--org.jumpi.impl.controller.stateless.StatelessController
The StatelessController provides a transparent Controller functionality, where messages are passed between client application and Connector layer without any flow control, concurrency support, ordering nor quality of service guarantees. Messages are handled opaquely, subject only to optional send transformation on send, and receive transformation when received. Any number of Connectors are supported. A message is sent to or received from a single Connector, which is the first to support the Destination's Url, determined in configuration order. Supports any Destination Url syntax which the Connectors support.
The Destination Urls supported are those of the configured Connectors, without alteration.
Essentially compatible with all Connectors, however since no concurrency or synchronization support is provided, it is the responsibility of the client application to make sure the concurrency and synchronization requirements of the Connection components used are met. For example if a Connector does not support multiple concurrent sends to the same Destination, then this must be guaranteed by the client application.
Field Summary |
Fields inherited from class org.jumpi.impl.AbstractController |
connectors_, joinFailInterval_, joinTestInterval_, jumpi_, name_, recvTransformer_, sendTransformer_, started_, stopping_ |
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 | |
StatelessController()
|
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 pending receive operation. |
void |
cancelSend(Destination dest,
Handle hdl)
Cancel a pending send operation. |
protected boolean |
checkJoinCondition()
Checks when the Controller has truly finished work after receiving a shutdown command. |
Handle |
recv(Destination dest,
java.util.Hashtable clientProps)
Receive a message from the Destination, providing no quality of service guarantees, ordering nor concurrency support. |
Handle |
send(Destination dest,
java.lang.Object msg,
java.util.Hashtable clientProps)
Send the message to the Destination, providing no flow control, quality of service guarantees, ordering nor concurrency support. |
protected void |
shutdownState()
Fail and remove any receive or send operations which are pending at the Connector layer. |
Methods inherited from class org.jumpi.impl.AbstractController |
configure, getDestination, getName, manage, transferInternalProperties |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StatelessController()
Method Detail |
protected void shutdownState()
shutdownState
in class AbstractController
protected boolean checkJoinCondition()
Checks when the Controller has truly finished work after receiving a shutdown command. If there are no pending send or receive operations then, since no new operations can be started, we have a clean shutdown criteria.
checkJoinCondition
in class AbstractController
public Handle send(Destination dest, java.lang.Object msg, java.util.Hashtable clientProps)
Send the message to the Destination, providing no flow control, quality of service guarantees, ordering nor concurrency support. No message delivery guarantees are implemented over and above those provided by the Connector layer. Send operations are delegated to a single Connector which created the Destination in getDestination(). The StatelessController passes the message directly to the Connector after performing optional send transformation on the message. There is a 1:1 relationship between calls to send and those passed down to the Connector layer.
The message format required on entry is not defined since messages are handled as opaque objects, subject to send transformation once before passing to the Connector layer.
Potentially allows unlimited multiple concurrent send operations to the same Destination and different Destinations. Concurrency may be limited at the Connector layer.
Blocking or non blocking depending on the synchronization of the send method of the Connector. No synchronization nor flow control takes place in the Controller. The caller's thread is used to delegate to the Connection layer. Therefore send may block if the Connector's send method blocks. If the Connector's send method is synchronous, then the method only returns once the send has completed at the Connector.
The message is passed to the Connector and resides in the STATUS_SENDING transient state until either cancelSend is called by the client application or callbackSend is called by the Connector.
send
in interface Controller
send
in class AbstractController
dest
- the Destination to which the msg is to be sent.msg
- the message.clientProps
- not used but delegated in the Envelope to the
Connector.
public void callbackSend(Envelope env, boolean success, java.lang.String status)
callbackSend
in interface Controller
callbackSend
in class AbstractController
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.public Handle recv(Destination dest, java.util.Hashtable clientProps)
Receive a message from the Destination, providing no quality of service guarantees, ordering nor concurrency support. Receive operations are delegated to a single Connector which created the Destination in getDestination(). There is a 1:1 relationship between calls to receive and those passed down to the Connector layer.
The message format required on receive is not defined since messages are handled as opaque objects, subjected to receive transformation before passing to the client application in the Handle.
Potentially allows unlimited multiple concurrent receive operations to the same Destination and different Destinations. Concurrency may be limited at the Connector layer.
Blocking or non blocking depending on the synchronization of the receive method of the Connector. The caller's thread is used to delegate to the Connection layer. Therefore receive may block if the Connector's receive method blocks. If the Connector's receive method is synchronous, then the method only returns once the receive has completed at the Connector.
The message is passed to the Connector and resides in the STATUS_RECEIVING transient state until either cancelRecv is called by the client application or callbackRecv is called by the Connector.
recv
in interface Controller
recv
in class AbstractController
dest
- the Destination from which to receive a message.clientProps
- not used but delegated in the Envelope to the
Connector.
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()
callbackRecv
in interface Controller
callbackRecv
in class AbstractController
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.public void cancelSend(Destination dest, Handle hdl)
Cancel a pending send operation. The cancel method never blocks.
cancelSend
in interface Controller
cancelSend
in class AbstractController
dest
- the Destination of the send operation associated to hdl.hdl
- the Handle associated with the send operation to cancel.public void cancelRecv(Destination dest, Handle hdl)
Cancel a pending receive operation. The cancel method never blocks.
cancelRecv
in interface Controller
cancelRecv
in class AbstractController
dest
- the Destination of the receive operation associated to hdl.hdl
- the Handle associated with the receive operation to cancel.
|
Jumpi v1.2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |