org.activemq.transport.vm
Class VmTransportChannel

java.lang.Object
  extended byorg.activemq.transport.TransportChannelSupport
      extended byorg.activemq.transport.vm.VmTransportChannel
All Implemented Interfaces:
Runnable, Service, TransportChannel
Direct Known Subclasses:
PeerTransportChannel, RemoteTransportChannel

public class VmTransportChannel
extends TransportChannelSupport
implements Runnable

A VM implementation of a TransportChannel

Version:
$Revision: 1.1.1.1 $

Field Summary
 
Fields inherited from class org.activemq.transport.TransportChannelSupport
cachingEnabled, currentWireFormat, noDelay, pendingStop, transportConnected, usedInternally
 
Constructor Summary
VmTransportChannel()
           
VmTransportChannel(Channel sendChannel, Channel receiveChannel)
           
VmTransportChannel(int capacity)
           
 
Method Summary
 void asyncSend(Packet packet)
          Asynchronously send a Packet
 boolean canProcessWireFormatVersion(int version)
          Can this wireformat process packets of this version
 void connect(BrokerConnector brokerConnector)
          Connects the client side transport channel with the broker
protected  Channel createChannel(int capacity)
           
protected  PacketListener createPacketListenerSender()
          Creates a sender PacketListener which handles any receipts then delegates to the ultimate PacketListener (typically the JMS client)
 VmTransportChannel createServerSide()
          Creates the server side version of this client side channel.
protected  void doClose(Exception ex)
           
 boolean doesSupportMessageCompression()
          Some transports/wireformats will not be able to understand compressed messages
 boolean doesSupportMessageFragmentation()
          some transports/wire formats will implement their own fragementation
 boolean doesSupportWireFormatVersioning()
          Does the transport support wire format version info
 void forceDisconnect()
          Forces an immediate transport-level disconnect which will be asynchronously reported as an exception to the exceptionListener.
 int getCurrentWireFormatVersion()
           
protected static int getNextThreadId()
           
 int getReceiveCapacity()
           
 Channel getReceiveChannel()
           
 int getSendCapacity()
           
 Channel getSendChannel()
           
 PacketListener getSendListener()
           
 boolean isAsyncSend()
           
 boolean isMulticast()
           
 void run()
          reads packets from a Socket
 void setAsyncSend(boolean asyncSend)
           
 void setPacketListener(PacketListener listener)
          Set a listener for Packets
 void setReceiveCapacity(int receiveCapacity)
           
 void setReceiveChannel(Channel receiveChannel)
           
 void setSendCapacity(int sendCapacity)
           
 void setSendChannel(Channel sendChannel)
           
 void setSendListener(PacketListener sendListener)
           
 void start()
          start listeneing for events
 void stop()
          close the channel
 String toString()
          pretty print for object
 
Methods inherited from class org.activemq.transport.TransportChannelSupport
addTransportStatusEventListener, asyncSendWithReceipt, doAsyncSend, doConsumePacket, doConsumePacket, doHandleReceipt, doHandleWireFormat, fireStatusEvent, fireStatusEvent, getClientID, getEmbeddedBrokerConnector, getExceptionListener, getLastReceiptTimestamp, getPacketListener, getTransportChannelListener, getWireFormat, isCachingEnabled, isNoDelay, isPendingStop, isServerSide, isTransportConnected, isUsedInternally, onAsyncException, removeTransportStatusEventListener, requiresEmbeddedBroker, send, send, setCachingEnabled, setClientID, setExceptionListener, 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
 

Constructor Detail

VmTransportChannel

public VmTransportChannel()

VmTransportChannel

public VmTransportChannel(Channel sendChannel,
                          Channel receiveChannel)

VmTransportChannel

public VmTransportChannel(int capacity)
Method Detail

start

public void start()
           throws JMSException
Description copied from interface: TransportChannel
start listeneing for events

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

stop

public void stop()
Description copied from class: TransportChannelSupport
close the channel

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

forceDisconnect

public void forceDisconnect()
Description copied from interface: TransportChannel
Forces an immediate transport-level disconnect which will be asynchronously reported as an exception to the exceptionListener. If the channel isn't connected, the call will be ignored.

Specified by:
forceDisconnect in interface TransportChannel

asyncSend

public void asyncSend(Packet packet)
               throws JMSException
Asynchronously send a Packet

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

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)

run

public void run()
reads packets from a Socket

Specified by:
run in interface Runnable

toString

public String toString()
pretty print for object

Returns:
String representation of this object

connect

public void connect(BrokerConnector brokerConnector)
             throws JMSException
Connects the client side transport channel with the broker

Throws:
JMSException

createServerSide

public VmTransportChannel createServerSide()
                                    throws JMSException
Creates the server side version of this client side channel. On the server side the client's side sendChannel is the receiveChannel and vice versa

Returns:
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
Parameters:
listener -

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

doesSupportWireFormatVersioning

public boolean doesSupportWireFormatVersioning()
Does the transport support wire format version info

Specified by:
doesSupportWireFormatVersioning in interface TransportChannel
Overrides:
doesSupportWireFormatVersioning in class TransportChannelSupport
Returns:

getCurrentWireFormatVersion

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

doesSupportMessageFragmentation

public boolean doesSupportMessageFragmentation()
some transports/wire formats will implement their own fragementation

Specified by:
doesSupportMessageFragmentation in interface TransportChannel
Overrides:
doesSupportMessageFragmentation in class TransportChannelSupport
Returns:
true unless a transport/wire format supports it's own fragmentation

doesSupportMessageCompression

public boolean doesSupportMessageCompression()
Some transports/wireformats will not be able to understand compressed messages

Specified by:
doesSupportMessageCompression in interface TransportChannel
Overrides:
doesSupportMessageCompression in class TransportChannelSupport
Returns:
true unless a transport/wire format cannot understand compression

getReceiveCapacity

public int getReceiveCapacity()

setReceiveCapacity

public void setReceiveCapacity(int receiveCapacity)

getSendCapacity

public int getSendCapacity()

setSendCapacity

public void setSendCapacity(int sendCapacity)

isAsyncSend

public boolean isAsyncSend()

setAsyncSend

public void setAsyncSend(boolean asyncSend)

getSendChannel

public Channel getSendChannel()

setSendChannel

public void setSendChannel(Channel sendChannel)

getReceiveChannel

public Channel getReceiveChannel()

setReceiveChannel

public void setReceiveChannel(Channel receiveChannel)

getNextThreadId

protected static int getNextThreadId()

createChannel

protected Channel createChannel(int capacity)

createPacketListenerSender

protected PacketListener createPacketListenerSender()
Creates a sender PacketListener which handles any receipts then delegates to the ultimate PacketListener (typically the JMS client)

Returns:

doClose

protected void doClose(Exception ex)

getSendListener

public PacketListener getSendListener()

setSendListener

public void setSendListener(PacketListener sendListener)


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