org.activemq.transport.composite
Class CompositeTransportChannel

java.lang.Object
  extended by org.activemq.transport.TransportChannelSupport
      extended by org.activemq.transport.composite.CompositeTransportChannel
All Implemented Interfaces:
Service, TransportChannel, TransportStatusEventListener
Direct Known Subclasses:
ReliableTransportChannel

public class CompositeTransportChannel
extends TransportChannelSupport
implements TransportStatusEventListener

A Compsite implementation of a TransportChannel

Version:
$Revision: 1.2 $

Field Summary
protected  TransportChannel channel
           
protected  SynchronizedBoolean closed
           
protected  URI currentURI
           
protected  long establishConnectionTimeout
           
protected  long failureSleepTime
           
protected  boolean incrementTimeout
           
protected  int maximumRetries
           
protected  long maximumTimeout
           
protected  SynchronizedBoolean started
           
protected  List uris
           
 
Fields inherited from class org.activemq.transport.TransportChannelSupport
cachingEnabled, currentWireFormat, noDelay, pendingStop, transportConnected, usedInternally
 
Constructor Summary
CompositeTransportChannel(WireFormat wireFormat)
           
CompositeTransportChannel(WireFormat wireFormat, List uris)
           
 
Method Summary
 void asyncSend(Packet packet)
          Asynchronously send a Packet
 ReceiptHolder asyncSendWithReceipt(Packet packet)
          Asynchronously send a Packet with receipt.
protected  void attemptToConnect(URI uri)
           
 boolean canProcessWireFormatVersion(int version)
          Can this wireformat process packets of this version
protected  void configureChannel()
           
protected  void establishConnection(long timeout)
           
protected  URI extractURI(List list)
           
 void forceDisconnect()
          Forces disconnect by delegating to the child channel
 TransportChannel getChannel()
          Access to the current channel if one is active
 int getCurrentWireFormatVersion()
           
 long getEstablishConnectionTimeout()
          Return the maximum amount of time spent trying to establish a connection or a negative number to keep going forever
 long getFailureSleepTime()
           
 long getLastReceiptTimestamp()
          Gets the timestamp of the last received receipt packet.
 int getMaximumRetries()
           
 long getMaximumTimeout()
           
 List getUris()
           
 boolean isIncrementTimeout()
           
 boolean isMulticast()
           
 boolean isTransportConnected()
           
 Receipt send(Packet packet)
          synchronously send a Packet
 Receipt send(Packet packet, int timeout)
          Synchronously send a Packet
 void setClientID(String clientID)
          Provides a way to specify the client ID that this channel is using
 void setEstablishConnectionTimeout(long establishConnectionTimeout)
           
 void setExceptionListener(ExceptionListener listener)
          Set an exception listener to listen for asynchronously generated exceptions
 void setFailureSleepTime(long failureSleepTime)
           
 void setIncrementTimeout(boolean incrementTimeout)
           
 void setMaximumRetries(int maximumRetries)
           
 void setMaximumTimeout(long maximumTimeout)
           
 void setPacketListener(PacketListener listener)
          Set a listener for Packets
 void setUris(List list)
           
 void start()
          Called to start the service
 void statusChanged(TransportStatusEvent event)
          called when the status of a transport channel changes
 void stop()
          close the channel
 String toString()
           
 
Methods inherited from class org.activemq.transport.TransportChannelSupport
addTransportStatusEventListener, doAsyncSend, doConsumePacket, doConsumePacket, doesSupportMessageCompression, doesSupportMessageFragmentation, doesSupportWireFormatVersioning, doHandleReceipt, doHandleWireFormat, fireStatusEvent, fireStatusEvent, getClientID, getEmbeddedBrokerConnector, getExceptionListener, getPacketListener, getTransportChannelListener, getWireFormat, isCachingEnabled, isNoDelay, isPendingStop, isServerSide, isUsedInternally, onAsyncException, removeTransportStatusEventListener, requiresEmbeddedBroker, setCachingEnabled, setNoDelay, setPendingStop, setServerSide, setTransportChannelListener, setTransportConnected, setUsedInternally, setWireFormat, stopExecutor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uris

protected List uris

currentURI

protected URI currentURI

channel

protected TransportChannel channel

closed

protected SynchronizedBoolean closed

started

protected SynchronizedBoolean started

maximumRetries

protected int maximumRetries

failureSleepTime

protected long failureSleepTime

establishConnectionTimeout

protected long establishConnectionTimeout

maximumTimeout

protected long maximumTimeout

incrementTimeout

protected boolean incrementTimeout
Constructor Detail

CompositeTransportChannel

public CompositeTransportChannel(WireFormat wireFormat)

CompositeTransportChannel

public CompositeTransportChannel(WireFormat wireFormat,
                                 List uris)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

start

public void start()
           throws JMSException
Description copied from interface: Service
Called to start the service

Specified by:
start in interface Service
Specified by:
start in interface TransportChannel
Throws:
JMSException - if an error occurs

stop

public void stop()
close the channel

Specified by:
stop in interface Service
Specified by:
stop in interface TransportChannel
Overrides:
stop in class TransportChannelSupport

forceDisconnect

public void forceDisconnect()
Forces disconnect by delegating to the child channel

Specified by:
forceDisconnect in interface TransportChannel

send

public Receipt send(Packet packet)
             throws JMSException
Description copied from class: TransportChannelSupport
synchronously send a Packet

Specified by:
send in interface TransportChannel
Overrides:
send in class TransportChannelSupport
Returns:
a Receipt
Throws:
JMSException

send

public Receipt send(Packet packet,
                    int timeout)
             throws JMSException
Description copied from class: TransportChannelSupport
Synchronously send a Packet

Specified by:
send in interface TransportChannel
Overrides:
send in class TransportChannelSupport
Parameters:
packet - packet to send
timeout - amount of time to wait for a receipt
Returns:
the Receipt
Throws:
JMSException

asyncSend

public void asyncSend(Packet packet)
               throws JMSException
Description copied from interface: TransportChannel
Asynchronously send a Packet

Specified by:
asyncSend in interface TransportChannel
Parameters:
packet - the packet to send
Throws:
JMSException

asyncSendWithReceipt

public ReceiptHolder asyncSendWithReceipt(Packet packet)
                                   throws JMSException
Description copied from class: TransportChannelSupport
Asynchronously send a Packet with receipt.

Specified by:
asyncSendWithReceipt in interface TransportChannel
Overrides:
asyncSendWithReceipt in class TransportChannelSupport
Parameters:
packet - the packet to send
Returns:
a ReceiptHolder for the packet
Throws:
JMSException

setPacketListener

public void setPacketListener(PacketListener listener)
Description copied from class: TransportChannelSupport
Set a listener for Packets

Specified by:
setPacketListener in interface TransportChannel
Overrides:
setPacketListener in class TransportChannelSupport

setExceptionListener

public void setExceptionListener(ExceptionListener listener)
Description copied from class: TransportChannelSupport
Set an exception listener to listen for asynchronously generated exceptions

Specified by:
setExceptionListener in interface TransportChannel
Overrides:
setExceptionListener in class TransportChannelSupport

isMulticast

public boolean isMulticast()
Specified by:
isMulticast in interface TransportChannel
Overrides:
isMulticast in class TransportChannelSupport
Returns:
true if this transport is multicast based (i.e. broadcasts to multiple nodes)

getEstablishConnectionTimeout

public long getEstablishConnectionTimeout()
Return the maximum amount of time spent trying to establish a connection or a negative number to keep going forever

Returns:

setEstablishConnectionTimeout

public void setEstablishConnectionTimeout(long establishConnectionTimeout)

getMaximumRetries

public int getMaximumRetries()

setMaximumRetries

public void setMaximumRetries(int maximumRetries)

getFailureSleepTime

public long getFailureSleepTime()

setFailureSleepTime

public void setFailureSleepTime(long failureSleepTime)

getUris

public List getUris()

setUris

public void setUris(List list)

isIncrementTimeout

public boolean isIncrementTimeout()
Returns:
Returns the incrementTimeout.

setIncrementTimeout

public void setIncrementTimeout(boolean incrementTimeout)
Parameters:
incrementTimeout - The incrementTimeout to set.

getMaximumTimeout

public long getMaximumTimeout()
Returns:
Returns the maximumTimeout.

setMaximumTimeout

public void setMaximumTimeout(long maximumTimeout)
Parameters:
maximumTimeout - The maximumTimeout to set.

setClientID

public void setClientID(String clientID)
Description copied from interface: TransportChannel
Provides a way to specify the client ID that this channel is using

Specified by:
setClientID in interface TransportChannel
Overrides:
setClientID in class TransportChannelSupport
Parameters:
clientID - set the clientID

canProcessWireFormatVersion

public boolean canProcessWireFormatVersion(int version)
Can this wireformat process packets of this version

Specified by:
canProcessWireFormatVersion in interface TransportChannel
Overrides:
canProcessWireFormatVersion in class TransportChannelSupport
Parameters:
version - the version number to test
Returns:
true if can accept the version

getCurrentWireFormatVersion

public int getCurrentWireFormatVersion()
Specified by:
getCurrentWireFormatVersion in interface TransportChannel
Overrides:
getCurrentWireFormatVersion in class TransportChannelSupport
Returns:
the current version of this wire format

getChannel

public TransportChannel getChannel()
                            throws JMSException
Access to the current channel if one is active

Throws:
JMSException - if no channel is available

establishConnection

protected void establishConnection(long timeout)
                            throws JMSException
Throws:
JMSException

configureChannel

protected void configureChannel()

extractURI

protected URI extractURI(List list)
                  throws JMSException
Throws:
JMSException

attemptToConnect

protected void attemptToConnect(URI uri)
                         throws JMSException
Throws:
JMSException

statusChanged

public void statusChanged(TransportStatusEvent event)
Description copied from interface: TransportStatusEventListener
called when the status of a transport channel changes

Specified by:
statusChanged in interface TransportStatusEventListener

isTransportConnected

public boolean isTransportConnected()
Specified by:
isTransportConnected in interface TransportChannel
Overrides:
isTransportConnected in class TransportChannelSupport
Returns:
true if the transport channel is active, this value will be false through reconnecting

getLastReceiptTimestamp

public long getLastReceiptTimestamp()
Description copied from interface: TransportChannel
Gets the timestamp of the last received receipt packet.

Specified by:
getLastReceiptTimestamp in interface TransportChannel
Overrides:
getLastReceiptTimestamp in class TransportChannelSupport
Returns:
the timestamp in milliseconds


Copyright © 2004-2009 Protique, Ltd.. All Rights Reserved.