Class AutoTcpTransportServer
java.lang.Object
org.apache.activemq.util.ServiceSupport
org.apache.activemq.transport.TransportServerSupport
org.apache.activemq.transport.TransportServerThreadSupport
org.apache.activemq.transport.tcp.TcpTransportServer
org.apache.activemq.transport.auto.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-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.activemq.transport.tcp.TcpTransportServer
org.apache.activemq.transport.tcp.TcpTransportServer.TransportInfo -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BrokerServiceprotected intprotected final ThreadPoolExecutorprotected final ThreadPoolExecutorprotected intprotected final Map<String,ProtocolVerifier> Fields inherited from class org.apache.activemq.transport.tcp.TcpTransportServer
allowLinkStealing, backlog, connectionTimeout, currentTransportCount, dynamicManagement, jmxPort, logWriterName, maximumConnections, maximumConnectionsExceededCount, maxInactivityDuration, maxInactivityDurationInitalDelay, minmumWireFormatVersion, selector, serverSocket, serverSocketFactory, socketBufferSize, socketHandlerThread, socketQueue, soTimeout, startLogging, trace, transportFactory, useQueueForAccept, verifyHostName, wireFormatFactoryFields inherited from class org.apache.activemq.transport.TransportServerSupport
transportOptions -
Constructor Summary
ConstructorsConstructorDescriptionAutoTcpTransportServer(org.apache.activemq.transport.tcp.TcpTransportFactory transportFactory, URI location, ServerSocketFactory serverSocketFactory, BrokerService brokerService, Set<String> enabledProtocols) -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringprotected org.apache.activemq.transport.tcp.TcpTransportServer.TransportInfoconfigureTransport(org.apache.activemq.transport.tcp.TcpTransportServer server, Socket socket) protected org.apache.activemq.transport.tcp.TcpTransportcreateTransport(Socket socket, org.apache.activemq.wireformat.WireFormat format, org.apache.activemq.transport.tcp.TcpTransportFactory detectedTransportFactory, org.apache.activemq.transport.tcp.TcpTransport.InitBuffer initBuffer) protected AutoTcpTransportServer.ProtocolInfodetectProtocol(byte[] buffer) protected voiddoStop(org.apache.activemq.util.ServiceStopper stopper) org.apache.activemq.transport.TransportFactoryfindTransportFactory(String scheme, Map<String, ?> options) org.apache.activemq.wireformat.WireFormatFactoryintprotected voidhandleSocket(Socket socket) protected voidprotected voidprotected booleanvoidsetAutoTransportOptions(Map<String, Object> autoTransportOptions) voidsetEnabledProtocols(Set<String> enabledProtocols) voidsetMaxConnectionThreadPoolSize(int maxConnectionThreadPoolSize) Set the number of threads to be used for processing connections.voidsetProtocolDetectionTimeOut(int protocolDetectionTimeOut) voidsetWireFormatFactory(org.apache.activemq.wireformat.WireFormatFactory factory) voidprotected voidwaitForProtocolDetectionFinish(Future<?> future, AtomicInteger readBytes) Methods inherited from class org.apache.activemq.transport.tcp.TcpTransportServer
bind, createTransport, doHandleSocket, doStart, getBacklog, getConnectionTimeout, getCurrentTransportCount, getJmxPort, getLogWriterName, getMaxConnectionExceededCount, getMaximumConnections, getMaxInactivityDuration, getMaxInactivityDurationInitalDelay, getMinmumWireFormatVersion, getSocketAddress, getSocketBufferSize, getSoTimeout, getWireFormatFactory, isAllowLinkStealing, isDynamicManagement, isSslServer, isStartLogging, isTrace, isUseQueueForAccept, resetStatistics, resolveHostName, run, setAllowLinkStealing, setBacklog, setBrokerInfo, setConnectionTimeout, setDynamicManagement, setJmxPort, setLogWriterName, setMaximumConnections, setMaxInactivityDuration, setMaxInactivityDurationInitalDelay, setMinmumWireFormatVersion, setSocketBufferSize, setSoTimeout, setStartLogging, setTrace, setUseQueueForAccept, started, stopped, toStringMethods inherited from class org.apache.activemq.transport.TransportServerThreadSupport
getStackSize, isDaemon, isJoinOnStop, setDaemon, setJoinOnStop, setStackSizeMethods inherited from class org.apache.activemq.transport.TransportServerSupport
getAcceptListener, getBindLocation, getConnectURI, onAcceptError, setAcceptListener, setBindLocation, setConnectURI, setTransportOptionMethods inherited from class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.activemq.Service
start, stop
-
Field Details
-
wireFormatOptions
-
autoTransportOptions
-
enabledProtocols
-
protocolVerifiers
-
brokerService
-
newConnectionExecutor
-
protocolDetectionExecutor
-
maxConnectionThreadPoolSize
protected int maxConnectionThreadPoolSize -
protocolDetectionTimeOut
protected int protocolDetectionTimeOut
-
-
Constructor Details
-
AutoTcpTransportServer
public AutoTcpTransportServer(org.apache.activemq.transport.tcp.TcpTransportFactory transportFactory, URI location, ServerSocketFactory serverSocketFactory, BrokerService brokerService, Set<String> enabledProtocols) throws IOException, URISyntaxException - Parameters:
transportFactory-location-serverSocketFactory-- Throws:
IOExceptionURISyntaxException
-
-
Method Details
-
findWireFormatFactory
public org.apache.activemq.wireformat.WireFormatFactory findWireFormatFactory(String scheme, Map<String, Map<String, throws IOExceptionObject>> options) - Throws:
IOException
-
findTransportFactory
public org.apache.activemq.transport.TransportFactory findTransportFactory(String scheme, Map<String, ?> options) throws IOException- Throws:
IOException
-
append
-
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:
setWireFormatFactoryin classorg.apache.activemq.transport.tcp.TcpTransportServer
-
initProtocolVerifiers
protected void initProtocolVerifiers() -
initOpenWireProtocolVerifier
protected void initOpenWireProtocolVerifier() -
isAllProtocols
protected boolean isAllProtocols() -
handleSocket
- Overrides:
handleSocketin classorg.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:
configureTransportin classorg.apache.activemq.transport.tcp.TcpTransportServer- Throws:
Exception
-
waitForProtocolDetectionFinish
protected void waitForProtocolDetectionFinish(Future<?> future, AtomicInteger readBytes) throws Exception - 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
-
setWireFormatOptions
-
setEnabledProtocols
-
setAutoTransportOptions
-
doStop
- Overrides:
doStopin classorg.apache.activemq.transport.tcp.TcpTransportServer- Throws:
Exception
-
detectProtocol
- Throws:
IOException
-