org.apache.activemq.transport
Class TransportSupport

java.lang.Object
  extended by org.apache.activemq.util.ServiceSupport
      extended by org.apache.activemq.transport.TransportSupport
All Implemented Interfaces:
Service, Transport
Direct Known Subclasses:
BlockingQueueTransport, TransportThreadSupport

public abstract class TransportSupport
extends ServiceSupport
implements Transport

A useful base class for transport implementations.


Constructor Summary
TransportSupport()
           
 
Method Summary
 FutureResponse asyncRequest(java.lang.Object command, ResponseCallback responseCallback)
          An asynchronous request response where the Receipt will be returned in the future.
protected  void checkStarted()
           
 void doConsume(java.lang.Object command)
          Process the inbound command
 TransportListener getTransportListener()
          Returns the current transport listener
 boolean isConnected()
           
 boolean isDisposed()
           
 boolean isFaultTolerant()
          Indicates if the transport can handle faults
 boolean isReconnectSupported()
           
 boolean isUpdateURIsSupported()
           
<T> T
narrow(java.lang.Class<T> target)
          narrow acceptance
 void onException(java.io.IOException e)
          Passes any IO exceptions into the transport listener
 void reconnect(java.net.URI uri)
          reconnect to another location
 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 setTransportListener(TransportListener commandListener)
          Registers an inbound command listener
 void updateURIs(boolean reblance, java.net.URI[] uris)
          Provide a list of available alternative locations
 
Methods inherited from class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, doStart, doStop, isStarted, isStopped, isStopping, removeServiceListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.activemq.transport.Transport
getReceiveCounter, getRemoteAddress, oneway
 
Methods inherited from interface org.apache.activemq.Service
start, stop
 

Constructor Detail

TransportSupport

public TransportSupport()
Method Detail

getTransportListener

public TransportListener getTransportListener()
Returns the current transport listener

Specified by:
getTransportListener in interface Transport
Returns:

setTransportListener

public void setTransportListener(TransportListener commandListener)
Registers an inbound command listener

Specified by:
setTransportListener in interface Transport
Parameters:
commandListener -

narrow

public <T> T narrow(java.lang.Class<T> target)
narrow acceptance

Specified by:
narrow in interface Transport
Parameters:
target -
Returns:
'this' if assignable

asyncRequest

public FutureResponse asyncRequest(java.lang.Object command,
                                   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
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
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
Returns:
the repsonse or null if timeout
Throws:
java.io.IOException

doConsume

public void doConsume(java.lang.Object command)
Process the inbound command


onException

public void onException(java.io.IOException e)
Passes any IO exceptions into the transport listener


checkStarted

protected void checkStarted()
                     throws java.io.IOException
Throws:
java.io.IOException

isFaultTolerant

public boolean isFaultTolerant()
Description copied from interface: Transport
Indicates if the transport can handle faults

Specified by:
isFaultTolerant in interface Transport
Returns:
true if fault tolerant

reconnect

public void reconnect(java.net.URI uri)
               throws java.io.IOException
Description copied from interface: Transport
reconnect to another location

Specified by:
reconnect in interface Transport
Throws:
java.io.IOException - on failure of if not supported

isReconnectSupported

public boolean isReconnectSupported()
Specified by:
isReconnectSupported in interface Transport
Returns:
true if reconnect is supported

isUpdateURIsSupported

public boolean isUpdateURIsSupported()
Specified by:
isUpdateURIsSupported in interface Transport
Returns:
true if updating uris is supported

updateURIs

public void updateURIs(boolean reblance,
                       java.net.URI[] uris)
                throws java.io.IOException
Description copied from interface: Transport
Provide a list of available alternative locations

Specified by:
updateURIs in interface Transport
Throws:
java.io.IOException

isDisposed

public boolean isDisposed()
Specified by:
isDisposed in interface Transport
Returns:
true if the transport is disposed

isConnected

public boolean isConnected()
Specified by:
isConnected in interface Transport
Returns:
true if the transport is connected


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