Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.transport.tcp
Class TcpTransportChannel  view TcpTransportChannel download TcpTransportChannel.java

java.lang.Object
  extended byorg.activemq.transport.TransportChannelSupport
      extended byorg.activemq.transport.tcp.TcpTransportChannel
All Implemented Interfaces:
java.lang.Runnable, org.activemq.service.Service, org.activemq.transport.TransportChannel

public class TcpTransportChannel
extends org.activemq.transport.TransportChannelSupport
implements java.lang.Runnable

A tcp implementation of a TransportChannel

Version:
$Revision: 1.2 $

Field Summary
private  SynchronizedBoolean closed
           
protected  java.io.DataInputStream dataIn
           
protected  java.io.DataOutputStream dataOut
           
private static int DEFAULT_SOCKET_BUFFER_SIZE
           
private  EDU.oswego.cs.dl.util.concurrent.BoundedChannel exceptionsList
           
private  EDU.oswego.cs.dl.util.concurrent.Executor executor
           
private static org.apache.commons.logging.Log log
           
private  java.lang.Object outboundLock
           
private  TcpTransportServerChannel serverChannel
           
protected  java.net.Socket socket
           
private  int socketBufferSize
           
private  int soTimeout
           
private  SynchronizedBoolean started
           
private  java.lang.Thread thread
           
private  boolean useAsyncSend
           
private  org.activemq.io.WireFormatLoader wireFormatLoader
           
 
Fields inherited from class org.activemq.transport.TransportChannelSupport
cachingEnabled, currentWireFormat, noDelay, pendingStop, transportConnected, usedInternally
 
Constructor Summary
  TcpTransportChannel(TcpTransportServerChannel serverChannel, org.activemq.io.WireFormat wireFormat, java.net.Socket socket, EDU.oswego.cs.dl.util.concurrent.Executor executor)
          Initialize from a ServerSocket
protected TcpTransportChannel(org.activemq.io.WireFormat wireFormat)
          Construct basic helpers
  TcpTransportChannel(org.activemq.io.WireFormat wireFormat, java.net.Socket socket, EDU.oswego.cs.dl.util.concurrent.Executor executor)
           
  TcpTransportChannel(org.activemq.io.WireFormat wireFormat, java.net.URI remoteLocation)
          Connect to a remote Node - e.g.
  TcpTransportChannel(org.activemq.io.WireFormat wireFormat, java.net.URI remoteLocation, java.net.URI localLocation)
          Connect to a remote Node - e.g.
 
Method Summary
 void asyncSend(org.activemq.message.Packet packet)
          Asynchronously send a Packet
 boolean canProcessWireFormatVersion(int version)
          Can this wireformat process packets of this version
protected  void closeStreams()
           
protected  java.net.Socket createSocket(java.net.URI remoteLocation)
          Factory method to create a new socket
protected  java.net.Socket createSocket(java.net.URI remoteLocation, java.net.URI localLocation)
          Factory method to create a new socket
protected  org.activemq.message.Packet doAsyncSend(org.activemq.message.Packet packet)
          Actually performs the async send of a packet
protected  void doClose(java.lang.Exception ex)
           
 void forceDisconnect()
          Forces an immediate transport-level disconnect which will be asynchronously reported as an exception to the exceptionListener.
 int getCurrentWireFormatVersion()
           
 java.net.Socket getSocket()
           
 int getSocketBufferSize()
           
 int getSoTimeout()
           
protected  void initialiseSocket(java.net.Socket sock)
          Configures the socket for use
protected  void initializeStreams()
           
 boolean isClosed()
           
 boolean isMulticast()
           
 boolean isUseAsyncSend()
           
protected  void readWireFormat()
           
 void run()
          reads packets from a Socket
 void setNoDelay(boolean noDelay)
           
 void setSocketBufferSize(int socketBufferSize)
           
 void setSoTimeout(int soTimeout)
          set the socket so timeout
 void setUseAsyncSend(boolean useAsyncSend)
          set the useAsync flag
 void start()
          start listeneing for events
 void stop()
          close the channel
 java.lang.String toString()
          pretty print for object
 
Methods inherited from class org.activemq.transport.TransportChannelSupport
addTransportStatusEventListener, asyncSendWithReceipt, doConsumePacket, doConsumePacket, doesSupportMessageCompression, doesSupportMessageFragmentation, doesSupportWireFormatVersioning, 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, setPacketListener, 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

DEFAULT_SOCKET_BUFFER_SIZE

private static final int DEFAULT_SOCKET_BUFFER_SIZE
See Also:
Constant Field Values

log

private static final org.apache.commons.logging.Log log

socket

protected java.net.Socket socket

dataOut

protected java.io.DataOutputStream dataOut

dataIn

protected java.io.DataInputStream dataIn

wireFormatLoader

private org.activemq.io.WireFormatLoader wireFormatLoader

closed

private SynchronizedBoolean closed

started

private SynchronizedBoolean started

outboundLock

private java.lang.Object outboundLock

executor

private EDU.oswego.cs.dl.util.concurrent.Executor executor

thread

private java.lang.Thread thread

useAsyncSend

private boolean useAsyncSend

soTimeout

private int soTimeout

socketBufferSize

private int socketBufferSize

exceptionsList

private EDU.oswego.cs.dl.util.concurrent.BoundedChannel exceptionsList

serverChannel

private TcpTransportServerChannel serverChannel
Constructor Detail

TcpTransportChannel

protected TcpTransportChannel(org.activemq.io.WireFormat wireFormat)
Construct basic helpers


TcpTransportChannel

public TcpTransportChannel(org.activemq.io.WireFormat wireFormat,
                           java.net.URI remoteLocation)
                    throws javax.jms.JMSException
Connect to a remote Node - e.g. a Broker


TcpTransportChannel

public TcpTransportChannel(org.activemq.io.WireFormat wireFormat,
                           java.net.URI remoteLocation,
                           java.net.URI localLocation)
                    throws javax.jms.JMSException
Connect to a remote Node - e.g. a Broker


TcpTransportChannel

public TcpTransportChannel(TcpTransportServerChannel serverChannel,
                           org.activemq.io.WireFormat wireFormat,
                           java.net.Socket socket,
                           EDU.oswego.cs.dl.util.concurrent.Executor executor)
                    throws javax.jms.JMSException
Initialize from a ServerSocket


TcpTransportChannel

public TcpTransportChannel(org.activemq.io.WireFormat wireFormat,
                           java.net.Socket socket,
                           EDU.oswego.cs.dl.util.concurrent.Executor executor)
                    throws javax.jms.JMSException
Method Detail

start

public void start()
           throws javax.jms.JMSException
start listeneing for events

Specified by:
start in interface org.activemq.transport.TransportChannel

readWireFormat

protected void readWireFormat()
                       throws javax.jms.JMSException,
                              java.io.IOException

stop

public void stop()
close the channel

Specified by:
stop in interface org.activemq.transport.TransportChannel

forceDisconnect

public void forceDisconnect()
Description copied from interface: org.activemq.transport.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 org.activemq.transport.TransportChannel

asyncSend

public void asyncSend(org.activemq.message.Packet packet)
               throws javax.jms.JMSException
Asynchronously send a Packet

Specified by:
asyncSend in interface org.activemq.transport.TransportChannel

isMulticast

public boolean isMulticast()
Specified by:
isMulticast in interface org.activemq.transport.TransportChannel

run

public void run()
reads packets from a Socket

Specified by:
run in interface java.lang.Runnable

isClosed

public boolean isClosed()

toString

public java.lang.String toString()
pretty print for object


getSocket

public java.net.Socket getSocket()

canProcessWireFormatVersion

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

Specified by:
canProcessWireFormatVersion in interface org.activemq.transport.TransportChannel

getCurrentWireFormatVersion

public int getCurrentWireFormatVersion()
Specified by:
getCurrentWireFormatVersion in interface org.activemq.transport.TransportChannel

isUseAsyncSend

public boolean isUseAsyncSend()

setUseAsyncSend

public void setUseAsyncSend(boolean useAsyncSend)
set the useAsync flag


getSoTimeout

public int getSoTimeout()

setSoTimeout

public void setSoTimeout(int soTimeout)
                  throws javax.jms.JMSException
set the socket so timeout


setNoDelay

public void setNoDelay(boolean noDelay)
Specified by:
setNoDelay in interface org.activemq.transport.TransportChannel

getSocketBufferSize

public int getSocketBufferSize()

setSocketBufferSize

public void setSocketBufferSize(int socketBufferSize)

doAsyncSend

protected org.activemq.message.Packet doAsyncSend(org.activemq.message.Packet packet)
                                           throws javax.jms.JMSException
Actually performs the async send of a packet


doClose

protected void doClose(java.lang.Exception ex)

initialiseSocket

protected void initialiseSocket(java.net.Socket sock)
                         throws java.net.SocketException
Configures the socket for use


initializeStreams

protected void initializeStreams()
                          throws java.io.IOException

closeStreams

protected void closeStreams()
                     throws java.io.IOException

createSocket

protected java.net.Socket createSocket(java.net.URI remoteLocation)
                                throws java.net.UnknownHostException,
                                       java.io.IOException
Factory method to create a new socket


createSocket

protected java.net.Socket createSocket(java.net.URI remoteLocation,
                                       java.net.URI localLocation)
                                throws java.io.IOException,
                                       java.net.UnknownHostException
Factory method to create a new socket