public class AutoTcpTransportServer extends org.apache.activemq.transport.tcp.TcpTransportServer
TransportServer| Modifier and Type | Class and Description |
|---|---|
protected class |
AutoTcpTransportServer.ProtocolInfo |
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
autoTransportOptions |
protected BrokerService |
brokerService |
protected Set<String> |
enabledProtocols |
protected int |
maxConnectionThreadPoolSize |
protected ThreadPoolExecutor |
newConnectionExecutor |
protected ThreadPoolExecutor |
protocolDetectionExecutor |
protected int |
protocolDetectionTimeOut |
protected Map<String,ProtocolVerifier> |
protocolVerifiers |
protected Map<String,Map<String,Object>> |
wireFormatOptions |
allowLinkStealing, backlog, connectionTimeout, currentTransportCount, dynamicManagement, jmxPort, logWriterName, maximumConnections, maxInactivityDuration, maxInactivityDurationInitalDelay, minmumWireFormatVersion, selector, serverSocket, serverSocketFactory, socketBufferSize, socketHandlerThread, socketQueue, soTimeout, startLogging, trace, transportFactory, useQueueForAccept, verifyHostName, wireFormatFactory| Constructor and Description |
|---|
AutoTcpTransportServer(org.apache.activemq.transport.tcp.TcpTransportFactory transportFactory,
URI location,
ServerSocketFactory serverSocketFactory,
BrokerService brokerService,
Set<String> enabledProtocols) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
append(String currentScheme,
String scheme) |
protected org.apache.activemq.transport.tcp.TcpTransportServer.TransportInfo |
configureTransport(org.apache.activemq.transport.tcp.TcpTransportServer server,
Socket socket) |
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) |
protected AutoTcpTransportServer.ProtocolInfo |
detectProtocol(byte[] buffer) |
protected void |
doStop(org.apache.activemq.util.ServiceStopper stopper) |
org.apache.activemq.transport.TransportFactory |
findTransportFactory(String scheme,
Map<String,?> options) |
org.apache.activemq.wireformat.WireFormatFactory |
findWireFormatFactory(String scheme,
Map<String,Map<String,Object>> options) |
int |
getMaxConnectionThreadPoolSize() |
protected void |
handleSocket(Socket socket) |
protected void |
initOpenWireProtocolVerifier() |
protected void |
initProtocolVerifiers() |
protected boolean |
isAllProtocols() |
void |
setAutoTransportOptions(Map<String,Object> autoTransportOptions) |
void |
setEnabledProtocols(Set<String> enabledProtocols) |
void |
setMaxConnectionThreadPoolSize(int maxConnectionThreadPoolSize)
Set the number of threads to be used for processing connections.
|
void |
setProtocolDetectionTimeOut(int protocolDetectionTimeOut) |
void |
setWireFormatFactory(org.apache.activemq.wireformat.WireFormatFactory factory) |
void |
setWireFormatOptions(Map<String,Map<String,Object>> wireFormatOptions) |
protected void |
waitForProtocolDetectionFinish(Future<?> future,
AtomicInteger readBytes) |
bind, createTransport, doHandleSocket, doStart, getBacklog, getConnectionTimeout, getCurrentTransportCount, getJmxPort, getLogWriterName, getMaximumConnections, getMaxInactivityDuration, getMaxInactivityDurationInitalDelay, getMinmumWireFormatVersion, getSocketAddress, getSocketBufferSize, getSoTimeout, getWireFormatFactory, isAllowLinkStealing, isDynamicManagement, isSslServer, isStartLogging, isTrace, isUseQueueForAccept, resolveHostName, run, setAllowLinkStealing, setBacklog, setBrokerInfo, setConnectionTimeout, setDynamicManagement, setJmxPort, setLogWriterName, setMaximumConnections, setMaxInactivityDuration, setMaxInactivityDurationInitalDelay, setMinmumWireFormatVersion, setSocketBufferSize, setSoTimeout, setStartLogging, setTrace, setUseQueueForAccept, started, stopped, toStringgetStackSize, isDaemon, isJoinOnStop, setDaemon, setJoinOnStop, setStackSizegetAcceptListener, getBindLocation, getConnectURI, onAcceptError, setAcceptListener, setBindLocation, setConnectURI, setTransportOptionaddServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stopprotected Map<String,Object> autoTransportOptions
protected Set<String> enabledProtocols
protected final Map<String,ProtocolVerifier> protocolVerifiers
protected BrokerService brokerService
protected final ThreadPoolExecutor newConnectionExecutor
protected final ThreadPoolExecutor protocolDetectionExecutor
protected int maxConnectionThreadPoolSize
protected int protocolDetectionTimeOut
public AutoTcpTransportServer(org.apache.activemq.transport.tcp.TcpTransportFactory transportFactory, URI location, ServerSocketFactory serverSocketFactory, BrokerService brokerService, Set<String> enabledProtocols) throws IOException, URISyntaxException
transportFactory - location - serverSocketFactory - IOExceptionURISyntaxExceptionpublic org.apache.activemq.wireformat.WireFormatFactory findWireFormatFactory(String scheme, Map<String,Map<String,Object>> options) throws IOException
IOExceptionpublic org.apache.activemq.transport.TransportFactory findTransportFactory(String scheme, Map<String,?> options) throws IOException
IOExceptionpublic int getMaxConnectionThreadPoolSize()
public void setMaxConnectionThreadPoolSize(int maxConnectionThreadPoolSize)
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.
maxConnectionThreadPoolSize - TcpTransportServer#setMaximumConnections(int)}.public void setProtocolDetectionTimeOut(int protocolDetectionTimeOut)
public void setWireFormatFactory(org.apache.activemq.wireformat.WireFormatFactory factory)
setWireFormatFactory in class org.apache.activemq.transport.tcp.TcpTransportServerprotected void initProtocolVerifiers()
protected void initOpenWireProtocolVerifier()
protected boolean isAllProtocols()
protected void handleSocket(Socket socket)
handleSocket in class org.apache.activemq.transport.tcp.TcpTransportServerprotected org.apache.activemq.transport.tcp.TcpTransportServer.TransportInfo configureTransport(org.apache.activemq.transport.tcp.TcpTransportServer server, Socket socket) throws Exception
configureTransport in class org.apache.activemq.transport.tcp.TcpTransportServerExceptionprotected void waitForProtocolDetectionFinish(Future<?> future, AtomicInteger readBytes) throws Exception
Exceptionprotected 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
socket - format - detectedTransportFactory - IOExceptionpublic void setWireFormatOptions(Map<String,Map<String,Object>> wireFormatOptions)
public void setEnabledProtocols(Set<String> enabledProtocols)
public void setAutoTransportOptions(Map<String,Object> autoTransportOptions)
protected void doStop(org.apache.activemq.util.ServiceStopper stopper) throws Exception
doStop in class org.apache.activemq.transport.tcp.TcpTransportServerExceptionprotected AutoTcpTransportServer.ProtocolInfo detectProtocol(byte[] buffer) throws IOException
IOExceptionCopyright © 2005–2020 The Apache Software Foundation. All rights reserved.