org.codehaus.activemq.transport
Class AbstractTransportChannel

java.lang.Object
  extended byorg.codehaus.activemq.transport.AbstractTransportChannel
All Implemented Interfaces:
Service, TransportChannel
Direct Known Subclasses:
CompositeTransportChannel, EmberTransportChannel, GTransportChannel, JGroupsTransportChannel, JRMSTransportChannel, TcpTransportChannel, UdpTransportChannel, VmTransportChannel

public abstract class AbstractTransportChannel
extends java.lang.Object
implements TransportChannel

Some basic functionality, common across most transport implementations of channels

Version:
$Revision: 1.10 $

Constructor Summary
AbstractTransportChannel()
           
 
Method Summary
 void addTransportStatusEventListener(TransportStatusEventListener listener)
          Add a listener for changes in a channels status
protected  void doAsyncSend(Packet packet)
          send a Packet to the raw underlying transport This method is here to allow specific implementations to override this method
protected  void doConsumePacket(Packet packet)
          consume a packet from the channel
protected  boolean doHandleReceipt(Packet packet)
           
protected  void fireStatusEvent(TransportStatusEvent event)
          Fire status event to any status event listeners
protected  void fireStatusEvent(java.net.URI remoteURI, int status)
          Fire status event to any status event listeners
 java.lang.String getClientID()
          Returns the client ID that this channel is being used for
 ExceptionListener getExceptionListener()
           
 PacketListener getPacketListener()
           
 TransportChannelListener getTransportChannelListener()
           
protected  void onAsyncException(JMSException e)
          Handles an exception thrown while performing async dispatch of messages
 void removeTransportStatusEventListener(TransportStatusEventListener listener)
          Remove a listener for changes in a channels status
 Receipt send(Packet packet)
          synchronously send a Packet
 Receipt send(Packet packet, int timeout)
          Synchronously send a Packet
 void setClientID(java.lang.String clientID)
          Provides a way to specify the client ID that this channel is using
 void setExceptionListener(ExceptionListener listener)
          Set an exception listener to listen for asynchronously generated exceptions
 void setPacketListener(PacketListener l)
          Set a listener for Packets
 void setTransportChannelListener(TransportChannelListener transportChannelListener)
          A listener to be notified when the channel is removed
 void stop()
          close the channel
protected  void stopExecutor(Executor executor)
          A helper method to stop the execution of an executor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.activemq.transport.TransportChannel
asyncSend, isMulticast, start
 

Constructor Detail

AbstractTransportChannel

public AbstractTransportChannel()
Method Detail

stop

public void stop()
close the channel

Specified by:
stop in interface TransportChannel

send

public Receipt send(Packet packet)
             throws JMSException
synchronously send a Packet

Specified by:
send in interface TransportChannel
Parameters:
packet -
Returns:
a Receipt
Throws:
JMSException

send

public Receipt send(Packet packet,
                    int timeout)
             throws JMSException
Synchronously send a Packet

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

getTransportChannelListener

public TransportChannelListener getTransportChannelListener()

setTransportChannelListener

public void setTransportChannelListener(TransportChannelListener transportChannelListener)
Description copied from interface: TransportChannel
A listener to be notified when the channel is removed

Specified by:
setTransportChannelListener in interface TransportChannel
Parameters:
transportChannelListener -

addTransportStatusEventListener

public void addTransportStatusEventListener(TransportStatusEventListener listener)
Add a listener for changes in a channels status

Specified by:
addTransportStatusEventListener in interface TransportChannel
Parameters:
listener -

removeTransportStatusEventListener

public void removeTransportStatusEventListener(TransportStatusEventListener listener)
Remove a listener for changes in a channels status

Specified by:
removeTransportStatusEventListener in interface TransportChannel
Parameters:
listener -

getClientID

public java.lang.String getClientID()
Description copied from interface: TransportChannel
Returns the client ID that this channel is being used for

Specified by:
getClientID in interface TransportChannel

setClientID

public void setClientID(java.lang.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
Parameters:
clientID -

getExceptionListener

public ExceptionListener getExceptionListener()

getPacketListener

public PacketListener getPacketListener()

setPacketListener

public void setPacketListener(PacketListener l)
Set a listener for Packets

Specified by:
setPacketListener in interface TransportChannel
Parameters:
l -

setExceptionListener

public void setExceptionListener(ExceptionListener listener)
Set an exception listener to listen for asynchronously generated exceptions

Specified by:
setExceptionListener in interface TransportChannel
Parameters:
listener -

doConsumePacket

protected void doConsumePacket(Packet packet)
consume a packet from the channel

Parameters:
packet -

doHandleReceipt

protected boolean doHandleReceipt(Packet packet)

doAsyncSend

protected void doAsyncSend(Packet packet)
                    throws JMSException
send a Packet to the raw underlying transport This method is here to allow specific implementations to override this method

Parameters:
packet -
Throws:
JMSException

onAsyncException

protected void onAsyncException(JMSException e)
Handles an exception thrown while performing async dispatch of messages

Parameters:
e -

fireStatusEvent

protected void fireStatusEvent(java.net.URI remoteURI,
                               int status)
Fire status event to any status event listeners

Parameters:
remoteURI -
status -

fireStatusEvent

protected void fireStatusEvent(TransportStatusEvent event)
Fire status event to any status event listeners

Parameters:
event -

stopExecutor

protected void stopExecutor(Executor executor)
                     throws java.lang.InterruptedException,
                            JMSException
A helper method to stop the execution of an executor

Parameters:
executor - the executor or null if one is not created yet
Throws:
java.lang.InterruptedException
JMSException


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