org.codehaus.activemq.transport.tcp
Class TcpTransportChannel

java.lang.Object
  extended byorg.codehaus.activemq.transport.AbstractTransportChannel
      extended byorg.codehaus.activemq.transport.tcp.TcpTransportChannel
All Implemented Interfaces:
java.lang.Runnable, Service, TransportChannel
Direct Known Subclasses:
JxtaTransportChannel

public class TcpTransportChannel
extends AbstractTransportChannel
implements java.lang.Runnable

A tcp implementation of a TransportChannel

Version:
$Revision: 1.38 $

Field Summary
protected  java.net.Socket socket
           
 
Constructor Summary
protected TcpTransportChannel(WireFormat wireFormat)
          Construct basic helpers
  TcpTransportChannel(WireFormat wireFormat, java.net.Socket socket, Executor executor)
           
  TcpTransportChannel(WireFormat wireFormat, java.net.URI remoteLocation)
          Connect to a remote Node - e.g.
  TcpTransportChannel(WireFormat wireFormat, java.net.URI remoteLocation, java.net.URI localLocation)
          Connect to a remote Node - e.g.
 
Method Summary
 void asyncSend(Packet packet)
          Asynchronously send a Packet
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  void doAsyncSend(Packet packet)
          Actually performs the async send of a packet
 boolean isMulticast()
           
 void run()
          reads packets from a Socket
 void start()
          start listeneing for events
 void stop()
          close the channel
 java.lang.String toString()
          pretty print for object
 
Methods inherited from class org.codehaus.activemq.transport.AbstractTransportChannel
addTransportStatusEventListener, doConsumePacket, doHandleReceipt, fireStatusEvent, fireStatusEvent, getClientID, getExceptionListener, getPacketListener, getTransportChannelListener, onAsyncException, removeTransportStatusEventListener, send, send, setClientID, setExceptionListener, setPacketListener, setTransportChannelListener, stopExecutor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

socket

protected java.net.Socket socket
Constructor Detail

TcpTransportChannel

protected TcpTransportChannel(WireFormat wireFormat)
Construct basic helpers


TcpTransportChannel

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

Parameters:
remoteLocation -
Throws:
JMSException

TcpTransportChannel

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

Parameters:
remoteLocation -
localLocation - - e.g. local InetAddress and local port
Throws:
JMSException

TcpTransportChannel

public TcpTransportChannel(WireFormat wireFormat,
                           java.net.Socket socket,
                           Executor executor)
                    throws JMSException
Parameters:
socket -
Throws:
JMSException
Method Detail

stop

public void stop()
close the channel

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

start

public void start()
           throws JMSException
start listeneing for events

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

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
Returns:
false

run

public void run()
reads packets from a Socket

Specified by:
run in interface java.lang.Runnable

toString

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

Returns:
String representation of this object

doAsyncSend

protected void doAsyncSend(Packet packet)
                    throws JMSException
Actually performs the async send of a packet

Overrides:
doAsyncSend in class AbstractTransportChannel
Parameters:
packet -
Throws:
JMSException

createSocket

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

Parameters:
remoteLocation - the URI to connect to
Returns:
the newly created socket
Throws:
java.net.UnknownHostException
java.io.IOException

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

Parameters:
remoteLocation -
localLocation -
Returns:
@throws IOException
Throws:
java.io.IOException
java.net.UnknownHostException


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