org.activemq.transport.tcp
Class TcpTransportServerChannel

java.lang.Object
  extended by org.activemq.transport.TransportServerChannelSupport
      extended by org.activemq.transport.tcp.TcpTransportServerChannel
All Implemented Interfaces:
Runnable, Service, TransportServerChannel
Direct Known Subclasses:
JabberTransportServerChannel, StompTransportServerChannel

public class TcpTransportServerChannel
extends TransportServerChannelSupport
implements Runnable

Binds to a well known port and listens for Sockets ...

Version:
$Revision: 1.1.1.1 $

Field Summary
protected static int DEFAULT_BACKLOG
           
 
Constructor Summary
TcpTransportServerChannel(WireFormat wireFormat, ServerSocket serverSocket)
           
TcpTransportServerChannel(WireFormat wireFormat, URI bindAddr)
          Default Constructor
 
Method Summary
protected  ServerSocket createServerSocket(URI bind)
          Factory method to create a new ServerSocket
protected  TcpTransportChannel createTransportChannel(Socket socket, PooledExecutor executor)
           
 int getBacklog()
           
 int getMaxOutstandingMessages()
           
 InetSocketAddress getSocketAddress()
          An optional method to return the socket address if there is one on which this channel is listening.
 WireFormat getWireFormat()
           
 boolean isUseAsyncSend()
           
 void run()
          pull Sockets from the ServerSocket
 void setBacklog(int backlog)
           
 void setMaxOutstandingMessages(int maxOutstandingMessages)
           
 void setUseAsyncSend(boolean useAsyncSend)
           
 void setWireFormat(WireFormat wireFormat)
           
 void start()
          Called to start the service
 void stop()
          Called to shutdown the service
 String toString()
           
protected  void updatePhysicalUri(URI bindAddr)
          In cases where we construct ourselves with a zero port we need to regenerate the URI with the real physical port so that people can connect to us via discovery
 
Methods inherited from class org.activemq.transport.TransportServerChannelSupport
addClient, getTransportChannelListener, getUrl, removeClient, resolveHostName, setTransportChannelListener, setUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_BACKLOG

protected static final int DEFAULT_BACKLOG
See Also:
Constant Field Values
Constructor Detail

TcpTransportServerChannel

public TcpTransportServerChannel(WireFormat wireFormat,
                                 URI bindAddr)
                          throws JMSException
Default Constructor

Parameters:
bindAddr -
Throws:
JMSException

TcpTransportServerChannel

public TcpTransportServerChannel(WireFormat wireFormat,
                                 ServerSocket serverSocket)
                          throws JMSException
Throws:
JMSException
Method Detail

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 TransportServerChannel
Overrides:
start in class TransportServerChannelSupport
Throws:
JMSException - if an error occurs

stop

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

Specified by:
stop in interface Service
Specified by:
stop in interface TransportServerChannel
Overrides:
stop in class TransportServerChannelSupport
Throws:
JMSException

getSocketAddress

public InetSocketAddress getSocketAddress()
Description copied from interface: TransportServerChannel
An optional method to return the socket address if there is one on which this channel is listening. An implementation may return null for this operation; its mostly intended to be used for tooling to be able to access socket address information.

Specified by:
getSocketAddress in interface TransportServerChannel
Overrides:
getSocketAddress in class TransportServerChannelSupport
Returns:

toString

public String toString()
Overrides:
toString in class Object
Returns:
pretty print of this

run

public void run()
pull Sockets from the ServerSocket

Specified by:
run in interface Runnable

createTransportChannel

protected TcpTransportChannel createTransportChannel(Socket socket,
                                                     PooledExecutor executor)
                                              throws JMSException
Throws:
JMSException

isUseAsyncSend

public boolean isUseAsyncSend()

setUseAsyncSend

public void setUseAsyncSend(boolean useAsyncSend)

getMaxOutstandingMessages

public int getMaxOutstandingMessages()

setMaxOutstandingMessages

public void setMaxOutstandingMessages(int maxOutstandingMessages)

getBacklog

public int getBacklog()

setBacklog

public void setBacklog(int backlog)

getWireFormat

public WireFormat getWireFormat()

setWireFormat

public void setWireFormat(WireFormat wireFormat)

updatePhysicalUri

protected void updatePhysicalUri(URI bindAddr)
                          throws URISyntaxException
In cases where we construct ourselves with a zero port we need to regenerate the URI with the real physical port so that people can connect to us via discovery

Throws:
URISyntaxException

createServerSocket

protected ServerSocket createServerSocket(URI bind)
                                   throws UnknownHostException,
                                          IOException
Factory method to create a new ServerSocket

Throws:
UnknownHostException
IOException


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