org.apache.activemq.transport.reliable
Class ReliableTransport

java.lang.Object
  extended by org.apache.activemq.transport.TransportFilter
      extended by org.apache.activemq.transport.ResponseCorrelator
          extended by org.apache.activemq.transport.reliable.ReliableTransport
All Implemented Interfaces:
Service, Transport, TransportListener

public class ReliableTransport
extends ResponseCorrelator

This interceptor deals with out of order commands together with being able to handle dropped commands and the re-requesting dropped commands.


Field Summary
 
Fields inherited from class org.apache.activemq.transport.TransportFilter
next, transportListener
 
Constructor Summary
ReliableTransport(Transport next, ReplayStrategy replayStrategy)
           
ReliableTransport(Transport next, UdpTransport udpTransport)
           
 
Method Summary
protected  ReplayBuffer createReplayBuffer()
           
 int getBufferedCommandCount()
           
 int getExpectedCounter()
           
 ReplayBuffer getReplayBuffer()
           
 int getReplayBufferCommandCount()
           
 Replayer getReplayer()
           
 ReplayStrategy getReplayStrategy()
           
 int getRequestTimeout()
           
 void onCommand(java.lang.Object o)
          called to process a command
protected  void onMissingResponse(Command command, FutureResponse response)
          Lets attempt to replay the request as a command may have disappeared
protected  void replayCommands(ReplayCommand command)
           
 java.lang.Object request(java.lang.Object o)
          A synchronous request response
 java.lang.Object request(java.lang.Object o, int timeout)
          A synchronous request response
 void requestReplay(int fromCommandId, int toCommandId)
          Requests that a range of commands be replayed
 void setExpectedCounter(int expectedCounter)
          This property should never really be set - but is mutable primarily for test cases
 void setReplayBuffer(ReplayBuffer replayBuffer)
           
 void setReplayBufferCommandCount(int replayBufferSize)
          Sets the default number of commands which are buffered
 void setReplayer(Replayer replayer)
           
 void setReplayStrategy(ReplayStrategy replayStrategy)
           
 void setRequestTimeout(int requestTimeout)
          Sets the default timeout of requests before starting to request commands are replayed
 void start()
           
 java.lang.String toString()
           
 
Methods inherited from class org.apache.activemq.transport.ResponseCorrelator
asyncRequest, getSequenceGenerator, oneway, onException, stop
 
Methods inherited from class org.apache.activemq.transport.TransportFilter
getNext, getReceiveCounter, getRemoteAddress, getTransportListener, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, narrow, reconnect, setTransportListener, transportInterupted, transportResumed, updateURIs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReliableTransport

public ReliableTransport(Transport next,
                         ReplayStrategy replayStrategy)

ReliableTransport

public ReliableTransport(Transport next,
                         UdpTransport udpTransport)
                  throws java.io.IOException
Throws:
java.io.IOException
Method Detail

requestReplay

public void requestReplay(int fromCommandId,
                          int toCommandId)
Requests that a range of commands be replayed


request

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

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

request

public java.lang.Object request(java.lang.Object o,
                                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 ResponseCorrelator
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 ResponseCorrelator

getBufferedCommandCount

public int getBufferedCommandCount()

getExpectedCounter

public int getExpectedCounter()

setExpectedCounter

public void setExpectedCounter(int expectedCounter)
This property should never really be set - but is mutable primarily for test cases


getRequestTimeout

public int getRequestTimeout()

setRequestTimeout

public void setRequestTimeout(int requestTimeout)
Sets the default timeout of requests before starting to request commands are replayed


getReplayStrategy

public ReplayStrategy getReplayStrategy()

getReplayBuffer

public ReplayBuffer getReplayBuffer()

setReplayBuffer

public void setReplayBuffer(ReplayBuffer replayBuffer)

getReplayBufferCommandCount

public int getReplayBufferCommandCount()

setReplayBufferCommandCount

public void setReplayBufferCommandCount(int replayBufferSize)
Sets the default number of commands which are buffered


setReplayStrategy

public void setReplayStrategy(ReplayStrategy replayStrategy)

getReplayer

public Replayer getReplayer()

setReplayer

public void setReplayer(Replayer replayer)

toString

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

start

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

onMissingResponse

protected void onMissingResponse(Command command,
                                 FutureResponse response)
Lets attempt to replay the request as a command may have disappeared


createReplayBuffer

protected ReplayBuffer createReplayBuffer()

replayCommands

protected void replayCommands(ReplayCommand command)


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