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:
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  ServerSocket serverSocket
           
protected  ServerSocketFactory serverSocketFactory
           
protected  boolean trace
           
protected  TcpTransportFactory transportFactory
           
protected  Map transportOptions
           
protected  WireFormatFactory wireFormatFactory
           
 
Constructor Summary
TcpTransportServer(TcpTransportFactory transportFactory, URI location, ServerSocketFactory serverSocketFactory)
           
 
Method Summary
 void bind()
           
protected  Transport createTransport(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()
           
 InetSocketAddress getSocketAddress()
           
 WireFormatFactory getWireFormatFactory()
           
 boolean isTrace()
           
protected  String resolveHostName(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(Map transportOptions)
           
 void setWireFormatFactory(WireFormatFactory wireFormatFactory)
           
 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 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 Map transportOptions

serverSocketFactory

protected final ServerSocketFactory serverSocketFactory
Constructor Detail

TcpTransportServer

public TcpTransportServer(TcpTransportFactory transportFactory,
                          URI location,
                          ServerSocketFactory serverSocketFactory)
                   throws IOException,
                          URISyntaxException
Throws:
IOException
URISyntaxException
Method Detail

bind

public void bind()
          throws IOException
Throws:
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(Socket socket,
                                    WireFormat format)
                             throws IOException
Allow derived classes to override the Transport implementation that this transport server creates.

Parameters:
socket -
format -
Returns:
Throws:
IOException

toString

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

resolveHostName

protected String resolveHostName(String hostName)
                          throws UnknownHostException
Parameters:
hostName -
Returns:
real hostName
Throws:
UnknownHostException

doStop

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

getSocketAddress

public 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(Map transportOptions)


Copyright © 2011 Apache Software Foundation. All Rights Reserved.