Home » activemq-parent-5.3.1-source-release » org.apache » activemq » transport » tcp » [javadoc | source]
org.apache.activemq.transport.tcp
public class: TcpTransport [javadoc | source]
java.lang.Object
   org.apache.activemq.util.ServiceSupport
      org.apache.activemq.transport.TransportSupport
         org.apache.activemq.transport.TransportThreadSupport
            org.apache.activemq.transport.tcp.TcpTransport

All Implemented Interfaces:
    Service, Transport, Runnable

Direct Known Subclasses:
    XmppTransport, StompNIOTransport, SslTransport, NIOTransport

An implementation of the Transport interface using raw tcp/ip
Field Summary
protected final  URI remoteLocation     
protected final  URI localLocation     
protected final  WireFormat wireFormat     
protected  int connectionTimeout     
protected  int soTimeout     
protected  int socketBufferSize     
protected  int ioBufferSize     
protected  boolean closeAsync     
protected  Socket socket     
protected  DataOutputStream dataOut     
protected  DataInputStream dataIn     
protected  TcpBufferedOutputStream buffOut     
protected  boolean trace    trace=true -> the Transport stack where this TcpTransport object will be, will have a TransportLogger layer trace=false -> the Transport stack where this TcpTransport object will be, will NOT have a TransportLogger layer, and therefore will never be able to print logging messages. This parameter is most probably set in Connection or TransportConnector URIs. 
protected  String logWriterName    Name of the LogWriter implementation to use. Names are mapped to classes in the resources/META-INF/services/org/apache/activemq/transport/logwriters directory. This parameter is most probably set in Connection or TransportConnector URIs. 
protected  boolean dynamicManagement    Specifies if the TransportLogger will be manageable by JMX or not. Also, as long as there is at least 1 TransportLogger which is manageable, a TransportLoggerControl MBean will me created. 
protected  boolean startLogging    startLogging=true -> the TransportLogger object of the Transport stack will initially write messages to the log. startLogging=false -> the TransportLogger object of the Transport stack will initially NOT write messages to the log. This parameter only has an effect if trace == true. This parameter is most probably set in Connection or TransportConnector URIs. 
protected  int jmxPort    Specifies the port that will be used by the JMX server to manage the TransportLoggers. This should only be set in an URI by a client (producer or consumer) since a broker will already create a JMX server. It is useful for people who test a broker and clients in the same machine and want to control both via JMX; a different port will be needed. 
protected  boolean useLocalHost     
protected  int minmumWireFormatVersion     
protected  SocketFactory socketFactory     
protected final  AtomicReference<CountDownLatch> stoppedLatch     
Fields inherited from org.apache.activemq.transport.TransportSupport:
transportListener
Constructor:
 public TcpTransport(WireFormat wireFormat,
    Socket socket) throws IOException 
    Initialize from a server Socket
    Parameters:
    wireFormat -
    socket -
    Throws:
    IOException -
 public TcpTransport(WireFormat wireFormat,
    SocketFactory socketFactory,
    URI remoteLocation,
    URI localLocation) throws UnknownHostException, IOException 
    Connect to a remote Node - e.g. a Broker
    Parameters:
    wireFormat -
    socketFactory -
    remoteLocation -
    localLocation - - e.g. local InetAddress and local port
    Throws:
    IOException -
    UnknownHostException -
Method from org.apache.activemq.transport.tcp.TcpTransport Summary:
closeStreams,   connect,   doRun,   doStart,   doStop,   getConnectionTimeout,   getIoBufferSize,   getJmxPort,   getKeepAlive,   getLogWriterName,   getMinmumWireFormatVersion,   getReceiveCounter,   getRemoteAddress,   getSoTimeout,   getSocketBufferSize,   getTcpNoDelay,   initialiseSocket,   initializeStreams,   isCloseAsync,   isDynamicManagement,   isStartLogging,   isTrace,   isUseLocalHost,   narrow,   oneway,   readCommand,   resolveHostName,   run,   setCloseAsync,   setConnectionTimeout,   setDynamicManagement,   setIoBufferSize,   setJmxPort,   setKeepAlive,   setLogWriterName,   setMinmumWireFormatVersion,   setSoTimeout,   setSocketBufferSize,   setSocketOptions,   setStartLogging,   setTcpNoDelay,   setTrace,   setUseLocalHost,   stop,   toString
Methods from org.apache.activemq.transport.TransportThreadSupport:
doStart,   getStackSize,   isDaemon,   setDaemon,   setStackSize
Methods from org.apache.activemq.transport.TransportSupport:
asyncRequest,   checkStarted,   doConsume,   getTransportListener,   isConnected,   isDisposed,   isFaultTolerant,   narrow,   onException,   reconnect,   request,   request,   setTransportListener
Methods from org.apache.activemq.util.ServiceSupport:
addServiceListener,   dispose,   doStart,   doStop,   isStarted,   isStopped,   isStopping,   removeServiceListener,   start,   stop
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.activemq.transport.tcp.TcpTransport Detail:
 protected  void closeStreams() throws IOException 
 protected  void connect() throws Exception 
 protected  void doRun() throws IOException 
 protected  void doStart() throws Exception 
 protected  void doStop(ServiceStopper stopper) throws Exception 
 public int getConnectionTimeout() 
 public int getIoBufferSize() 
 public int getJmxPort() 
 public Boolean getKeepAlive() 
 public String getLogWriterName() 
 public int getMinmumWireFormatVersion() 
 public int getReceiveCounter() 
 public String getRemoteAddress() 
 public int getSoTimeout() 
 public int getSocketBufferSize() 
 public Boolean getTcpNoDelay() 
 protected  void initialiseSocket(Socket sock) throws SocketException 
    Configures the socket for use
 protected  void initializeStreams() throws Exception 
 public boolean isCloseAsync() 
 public boolean isDynamicManagement() 
 public boolean isStartLogging() 
 public boolean isTrace() 
 public boolean isUseLocalHost() 
 public T narrow(Class<T> target) 
 public  void oneway(Object command) throws IOException 
    A one way asynchronous send
 protected Object readCommand() throws IOException 
 protected String resolveHostName(String host) throws UnknownHostException 
 public  void run() 
    reads packets from a Socket
 public  void setCloseAsync(boolean closeAsync) 
 public  void setConnectionTimeout(int connectionTimeout) 
    Sets the timeout used to connect to the socket
 public  void setDynamicManagement(boolean useJmx) 
 public  void setIoBufferSize(int ioBufferSize) 
 public  void setJmxPort(int jmxPort) 
 public  void setKeepAlive(Boolean keepAlive) 
    Enable/disable TCP KEEP_ALIVE mode
 public  void setLogWriterName(String logFormat) 
 public  void setMinmumWireFormatVersion(int minmumWireFormatVersion) 
 public  void setSoTimeout(int soTimeout) 
    Sets the socket timeout
 public  void setSocketBufferSize(int socketBufferSize) 
    Sets the buffer size to use on the socket
 public  void setSocketOptions(Map<String, Object> socketOptions) 
 public  void setStartLogging(boolean startLogging) 
 public  void setTcpNoDelay(Boolean tcpNoDelay) 
    Enable/disable the TCP_NODELAY option on the socket
 public  void setTrace(boolean trace) 
 public  void setUseLocalHost(boolean useLocalHost) 
    Sets whether 'localhost' or the actual local host name should be used to make local connections. On some operating systems such as Macs its not possible to connect as the local host name so localhost is better.
 public  void stop() throws Exception 
    Override so that stop() blocks until the run thread is no longer running.
 public String toString()