Package org.apache.activemq.transport
Class ResponseCorrelator
- java.lang.Object
-
- org.apache.activemq.transport.TransportFilter
-
- org.apache.activemq.transport.ResponseCorrelator
-
- All Implemented Interfaces:
Service,Transport,TransportListener
- Direct Known Subclasses:
ReliableTransport
public class ResponseCorrelator extends TransportFilter
Adds the incrementing sequence number to commands along with performing the correlation of responses to requests to create a blocking request-response semantics.
-
-
Field Summary
-
Fields inherited from class org.apache.activemq.transport.TransportFilter
next, transportListener
-
-
Constructor Summary
Constructors Constructor Description ResponseCorrelator(Transport next)ResponseCorrelator(Transport next, IntSequenceGenerator sequenceGenerator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FutureResponseasyncRequest(Object o, ResponseCallback responseCallback)An asynchronous request response where the Receipt will be returned in the future.IntSequenceGeneratorgetSequenceGenerator()voidonCommand(Object o)called to process a commandvoidoneway(Object o)A one way asynchronous sendvoidonException(IOException error)If an async exception occurs, then assume no responses will arrive for any of current requests.Objectrequest(Object command)A synchronous request responseObjectrequest(Object command, int timeout)A synchronous request responsevoidstop()StringtoString()-
Methods inherited from class org.apache.activemq.transport.TransportFilter
getNext, getPeerCertificates, getReceiveCounter, getRemoteAddress, getTransportListener, getWireFormat, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, narrow, reconnect, setPeerCertificates, setTransportListener, start, transportInterupted, transportResumed, updateURIs
-
-
-
-
Constructor Detail
-
ResponseCorrelator
public ResponseCorrelator(Transport next)
-
ResponseCorrelator
public ResponseCorrelator(Transport next, IntSequenceGenerator sequenceGenerator)
-
-
Method Detail
-
oneway
public void oneway(Object o) throws IOException
Description copied from interface:TransportA one way asynchronous send- Specified by:
onewayin interfaceTransport- Overrides:
onewayin classTransportFilter- Throws:
IOException
-
asyncRequest
public FutureResponse asyncRequest(Object o, ResponseCallback responseCallback) throws IOException
Description copied from interface:TransportAn asynchronous request response where the Receipt will be returned in the future. If responseCallback is not null, then it will be called when the response has been completed.- Specified by:
asyncRequestin interfaceTransport- Overrides:
asyncRequestin classTransportFilterresponseCallback- TODO- Returns:
- the FutureResponse
- Throws:
IOException
-
request
public Object request(Object command) throws IOException
Description copied from interface:TransportA synchronous request response- Specified by:
requestin interfaceTransport- Overrides:
requestin classTransportFilter- Returns:
- the response
- Throws:
IOException
-
request
public Object request(Object command, int timeout) throws IOException
Description copied from interface:TransportA synchronous request response- Specified by:
requestin interfaceTransport- Overrides:
requestin classTransportFilter- Returns:
- the repsonse or null if timeout
- Throws:
IOException
-
onCommand
public void onCommand(Object o)
Description copied from interface:TransportListenercalled to process a command- Specified by:
onCommandin interfaceTransportListener- Overrides:
onCommandin classTransportFilter
-
onException
public void onException(IOException error)
If an async exception occurs, then assume no responses will arrive for any of current requests. Lets let them know of the problem.- Specified by:
onExceptionin interfaceTransportListener- Overrides:
onExceptionin classTransportFilter
-
stop
public void stop() throws Exception- Specified by:
stopin interfaceService- Overrides:
stopin classTransportFilter- Throws:
Exception- See Also:
Service.stop()
-
getSequenceGenerator
public IntSequenceGenerator getSequenceGenerator()
-
toString
public String toString()
- Overrides:
toStringin classTransportFilter
-
-