org.apache.activemq.transport.tcp
Class TcpTransportServer

java.lang.Object
  extended by org.apache.activemq.util.ServiceSupport
      extended by org.apache.activemq.transport.TransportServerSupport
          extended by org.apache.activemq.transport.TransportServerThreadSupport
              extended by org.apache.activemq.transport.tcp.TcpTransportServer
All Implemented Interfaces:
java.lang.Runnable, Service, TransportServer
Direct Known Subclasses:
SslTransportServer, XmppTransportServer

public class TcpTransportServer
extends TransportServerThreadSupport

A TCP based implementation of TransportServer

Version:
$Revision: 1.1 $

Field Summary
protected  int backlog
           
protected  long maxInactivityDuration
           
protected  int minmumWireFormatVersion
           
protected  java.net.ServerSocket serverSocket
           
protected  javax.net.ServerSocketFactory serverSocketFactory
           
protected  boolean trace
           
protected  TcpTransportFactory transportFactory
           
protected  java.util.Map transportOptions
           
protected  WireFormatFactory wireFormatFactory
           
 
Constructor Summary
TcpTransportServer(TcpTransportFactory transportFactory, java.net.URI location, javax.net.ServerSocketFactory serverSocketFactory)
           
 
Method Summary
 void bind()
           
protected  Transport createTransport(java.net.Socket socket, WireFormat format)
          Allow derived classes to override the Transport implementation that this transport server creates.
protected  void doStop(ServiceStopper stopper)
           
 long getMaxInactivityDuration()
           
 int getMinmumWireFormatVersion()
           
 java.net.InetSocketAddress getSocketAddress()
           
 WireFormatFactory getWireFormatFactory()
           
 boolean isTrace()
           
protected  java.lang.String resolveHostName(java.lang.String hostName)
           
 void run()
          pull Sockets from the ServerSocket
 void setBrokerInfo(BrokerInfo brokerInfo)
          Associates a broker info with the transport server so that the transport can do discovery advertisements of the broker.
 void setMaxInactivityDuration(long maxInactivityDuration)
           
 void setMinmumWireFormatVersion(int minmumWireFormatVersion)
           
 void setTrace(boolean trace)
           
 void setTransportOption(java.util.Map transportOptions)
           
 void setWireFormatFactory(WireFormatFactory wireFormatFactory)
           
 java.lang.String toString()
           
 
Methods inherited from class org.apache.activemq.transport.TransportServerThreadSupport
doStart, isDaemon, isJoinOnStop, setDaemon, setJoinOnStop
 
Methods inherited from class org.apache.activemq.transport.TransportServerSupport
getAcceptListener, getBindLocation, getConnectURI, onAcceptError, setAcceptListener, setBindLocation, setConnectURI
 
Methods inherited from class org.apache.activemq.util.ServiceSupport
dispose, isStarted, isStopped, isStopping, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.activemq.Service
start, stop
 

Field Detail

serverSocket

protected java.net.ServerSocket serverSocket

backlog

protected int backlog

wireFormatFactory

protected WireFormatFactory wireFormatFactory

transportFactory

protected final TcpTransportFactory transportFactory

maxInactivityDuration

protected long maxInactivityDuration

minmumWireFormatVersion

protected int minmumWireFormatVersion

trace

protected boolean trace

transportOptions

protected java.util.Map transportOptions

serverSocketFactory

protected final javax.net.ServerSocketFactory serverSocketFactory
Constructor Detail

TcpTransportServer

public TcpTransportServer(TcpTransportFactory transportFactory,
                          java.net.URI location,
                          javax.net.ServerSocketFactory serverSocketFactory)
                   throws java.io.IOException,
                          java.net.URISyntaxException
Throws:
java.io.IOException
java.net.URISyntaxException
Method Detail

bind

public void bind()
          throws java.io.IOException
Throws:
java.io.IOException

getWireFormatFactory

public WireFormatFactory getWireFormatFactory()
Returns:
Returns the wireFormatFactory.

setWireFormatFactory

public void setWireFormatFactory(WireFormatFactory wireFormatFactory)
Parameters:
wireFormatFactory - The wireFormatFactory to set.

setBrokerInfo

public void setBrokerInfo(BrokerInfo brokerInfo)
Associates a broker info with the transport server so that the transport can do discovery advertisements of the broker.

Parameters:
brokerInfo -

getMaxInactivityDuration

public long getMaxInactivityDuration()

setMaxInactivityDuration

public void setMaxInactivityDuration(long maxInactivityDuration)

getMinmumWireFormatVersion

public int getMinmumWireFormatVersion()

setMinmumWireFormatVersion

public void setMinmumWireFormatVersion(int minmumWireFormatVersion)

isTrace

public boolean isTrace()

setTrace

public void setTrace(boolean trace)

run

public void run()
pull Sockets from the ServerSocket


createTransport

protected Transport createTransport(java.net.Socket socket,
                                    WireFormat format)
                             throws java.io.IOException
Allow derived classes to override the Transport implementation that this transport server creates.

Parameters:
socket -
format -
Returns:
Throws:
java.io.IOException

toString

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

resolveHostName

protected java.lang.String resolveHostName(java.lang.String hostName)
                                    throws java.net.UnknownHostException
Parameters:
hostName -
Returns:
real hostName
Throws:
java.net.UnknownHostException

doStop

protected void doStop(ServiceStopper stopper)
               throws java.lang.Exception
Overrides:
doStop in class TransportServerThreadSupport
Throws:
java.lang.Exception

getSocketAddress

public java.net.InetSocketAddress getSocketAddress()
Returns:
The socket address that this transport is accepting connections on or null if this does not or is not currently accepting connections on a socket.

setTransportOption

public void setTransportOption(java.util.Map transportOptions)


Copyright © 2010 Apache Software Foundation. All Rights Reserved.