Class AutoTcpTransportServer

  • All Implemented Interfaces:
    Runnable, org.apache.activemq.Service, org.apache.activemq.transport.TransportServer, org.apache.activemq.util.ServiceListener
    Direct Known Subclasses:
    AutoNIOSSLTransportServer, AutoSslTransportServer

    public class AutoTcpTransportServer
    extends org.apache.activemq.transport.tcp.TcpTransportServer
    A TCP based implementation of TransportServer
    • Field Detail

      • autoTransportOptions

        protected Map<String,​Object> autoTransportOptions
      • enabledProtocols

        protected Set<String> enabledProtocols
      • maxConnectionThreadPoolSize

        protected int maxConnectionThreadPoolSize
      • protocolDetectionTimeOut

        protected int protocolDetectionTimeOut
    • Method Detail

      • getMaxConnectionThreadPoolSize

        public int getMaxConnectionThreadPoolSize()
      • setMaxConnectionThreadPoolSize

        public void setMaxConnectionThreadPoolSize​(int maxConnectionThreadPoolSize)
        Set the number of threads to be used for processing connections. Defaults to Integer.MAX_SIZE. Set this value to be lower to reduce the number of simultaneous connection attempts. If not set then the maximum number of threads will generally be controlled by the transport maxConnections setting: TcpTransportServer.setMaximumConnections(int).

        Note that this setter controls two thread pools because connection attempts require 1 thread to start processing the connection and another thread to read from the socket and to detect the protocol. Two threads are needed because some transports block on socket read so the first thread needs to be able to abort the second thread on timeout. Therefore this setting will set each thread pool to the size passed in essentially giving 2 times as many potential threads as the value set.

        Both thread pools will close idle threads after a period of time essentially allowing the thread pools to grow and shrink dynamically based on load.

        Parameters:
        maxConnectionThreadPoolSize -
      • setProtocolDetectionTimeOut

        public void setProtocolDetectionTimeOut​(int protocolDetectionTimeOut)
      • setWireFormatFactory

        public void setWireFormatFactory​(org.apache.activemq.wireformat.WireFormatFactory factory)
        Overrides:
        setWireFormatFactory in class org.apache.activemq.transport.tcp.TcpTransportServer
      • initProtocolVerifiers

        protected void initProtocolVerifiers()
      • initOpenWireProtocolVerifier

        protected void initOpenWireProtocolVerifier()
      • isAllProtocols

        protected boolean isAllProtocols()
      • handleSocket

        protected void handleSocket​(Socket socket)
        Overrides:
        handleSocket in class org.apache.activemq.transport.tcp.TcpTransportServer
      • configureTransport

        protected org.apache.activemq.transport.tcp.TcpTransportServer.TransportInfo configureTransport​(org.apache.activemq.transport.tcp.TcpTransportServer server,
                                                                                                        Socket socket)
                                                                                                 throws Exception
        Overrides:
        configureTransport in class org.apache.activemq.transport.tcp.TcpTransportServer
        Throws:
        Exception
      • createTransport

        protected org.apache.activemq.transport.tcp.TcpTransport createTransport​(Socket socket,
                                                                                 org.apache.activemq.wireformat.WireFormat format,
                                                                                 org.apache.activemq.transport.tcp.TcpTransportFactory detectedTransportFactory,
                                                                                 org.apache.activemq.transport.tcp.TcpTransport.InitBuffer initBuffer)
                                                                          throws IOException
        Parameters:
        socket -
        format -
        detectedTransportFactory -
        Returns:
        Throws:
        IOException
      • setEnabledProtocols

        public void setEnabledProtocols​(Set<String> enabledProtocols)
      • setAutoTransportOptions

        public void setAutoTransportOptions​(Map<String,​Object> autoTransportOptions)
      • doStop

        protected void doStop​(org.apache.activemq.util.ServiceStopper stopper)
                       throws Exception
        Overrides:
        doStop in class org.apache.activemq.transport.tcp.TcpTransportServer
        Throws:
        Exception