org.apache.activemq.transport
Class ResponseCorrelator

java.lang.Object
  extended by org.apache.activemq.transport.TransportFilter
      extended by 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 corelation 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
ResponseCorrelator(Transport next)
           
ResponseCorrelator(Transport next, IntSequenceGenerator sequenceGenerator)
           
 
Method Summary
 FutureResponse asyncRequest(java.lang.Object o, ResponseCallback responseCallback)
          An asynchronous request response where the Receipt will be returned in the future.
 IntSequenceGenerator getSequenceGenerator()
           
 void onCommand(java.lang.Object o)
          called to process a command
 void oneway(java.lang.Object o)
          A one way asynchronous send
 void onException(java.io.IOException error)
          If an async exception occurs, then assume no responses will arrive for any of current requests.
 java.lang.Object request(java.lang.Object command)
          A synchronous request response
 java.lang.Object request(java.lang.Object command, int timeout)
          A synchronous request response
 void stop()
           
 java.lang.String toString()
           
 
Methods inherited from class org.apache.activemq.transport.TransportFilter
getNext, getReceiveCounter, getRemoteAddress, getTransportListener, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, narrow, reconnect, setTransportListener, start, transportInterupted, transportResumed, updateURIs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResponseCorrelator

public ResponseCorrelator(Transport next)

ResponseCorrelator

public ResponseCorrelator(Transport next,
                          IntSequenceGenerator sequenceGenerator)
Method Detail

oneway

public void oneway(java.lang.Object o)
            throws java.io.IOException
Description copied from interface: Transport
A one way asynchronous send

Specified by:
oneway in interface Transport
Overrides:
oneway in class TransportFilter
Throws:
java.io.IOException

asyncRequest

public FutureResponse asyncRequest(java.lang.Object o,
                                   ResponseCallback responseCallback)
                            throws java.io.IOException
Description copied from interface: Transport
An 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:
asyncRequest in interface Transport
Overrides:
asyncRequest in class TransportFilter
responseCallback - TODO
Returns:
the FutureResponse
Throws:
java.io.IOException

request

public java.lang.Object request(java.lang.Object command)
                         throws java.io.IOException
Description copied from interface: Transport
A synchronous request response

Specified by:
request in interface Transport
Overrides:
request in class TransportFilter
Returns:
the response
Throws:
java.io.IOException

request

public java.lang.Object request(java.lang.Object command,
                                int timeout)
                         throws java.io.IOException
Description copied from interface: Transport
A synchronous request response

Specified by:
request in interface Transport
Overrides:
request in class TransportFilter
Returns:
the repsonse or null if timeout
Throws:
java.io.IOException

onCommand

public void onCommand(java.lang.Object o)
Description copied from interface: TransportListener
called to process a command

Specified by:
onCommand in interface TransportListener
Overrides:
onCommand in class TransportFilter

onException

public void onException(java.io.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:
onException in interface TransportListener
Overrides:
onException in class TransportFilter

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Service
Overrides:
stop in class TransportFilter
Throws:
java.lang.Exception
See Also:
Service.stop()

getSequenceGenerator

public IntSequenceGenerator getSequenceGenerator()

toString

public java.lang.String toString()
Overrides:
toString in class TransportFilter


Copyright © 2005-2011 FuseSource, Corp.. All Rights Reserved.