public class TcpTransportServer extends TransportServerThreadSupport implements ServiceListener
TransportServer| Modifier and Type | Class and Description |
|---|---|
protected class |
TcpTransportServer.TransportInfo |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
allowLinkStealing |
protected int |
backlog |
protected int |
connectionTimeout |
protected AtomicInteger |
currentTransportCount |
protected boolean |
dynamicManagement
Specifies if the TransportLogger will be manageable by JMX or not.
|
protected int |
jmxPort |
protected String |
logWriterName
Name of the LogWriter implementation to use.
|
protected int |
maximumConnections
The maximum number of sockets allowed for this server
|
protected long |
maxInactivityDuration |
protected long |
maxInactivityDurationInitalDelay |
protected int |
minmumWireFormatVersion |
protected Selector |
selector |
protected ServerSocket |
serverSocket |
protected ServerSocketFactory |
serverSocketFactory |
protected int |
socketBufferSize |
protected Thread |
socketHandlerThread |
protected BlockingQueue<Socket> |
socketQueue |
protected int |
soTimeout |
protected boolean |
startLogging
startLogging=true -> the TransportLogger object of the Transport stack will initially write messages to the log.
|
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.
|
protected TcpTransportFactory |
transportFactory |
protected boolean |
useQueueForAccept |
protected boolean |
verifyHostName |
protected WireFormatFactory |
wireFormatFactory |
transportOptions| Constructor and Description |
|---|
TcpTransportServer(TcpTransportFactory transportFactory,
URI location,
ServerSocketFactory serverSocketFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
bind() |
protected TcpTransportServer.TransportInfo |
configureTransport(TcpTransportServer server,
Socket socket) |
protected Transport |
createTransport(Socket socket,
WireFormat format)
Allow derived classes to override the Transport implementation that this transport server creates.
|
protected void |
doHandleSocket(Socket socket) |
protected void |
doStart() |
protected void |
doStop(ServiceStopper stopper) |
int |
getBacklog() |
int |
getConnectionTimeout() |
AtomicInteger |
getCurrentTransportCount() |
int |
getJmxPort() |
String |
getLogWriterName() |
int |
getMaximumConnections() |
long |
getMaxInactivityDuration() |
long |
getMaxInactivityDurationInitalDelay() |
int |
getMinmumWireFormatVersion() |
InetSocketAddress |
getSocketAddress() |
int |
getSocketBufferSize() |
int |
getSoTimeout() |
WireFormatFactory |
getWireFormatFactory() |
protected void |
handleSocket(Socket socket) |
boolean |
isAllowLinkStealing()
Some protocols allow link stealing by default (if 2 connections have the same clientID - the youngest wins).
|
boolean |
isDynamicManagement() |
boolean |
isSslServer()
For TransportServers that provide SSL connections to their connected peers they should
return true here if and only if they populate the ConnectionInfo command presented to
the Broker with the peers certificate chain so that the broker knows it can use that
information to authenticate the connected peer.
|
boolean |
isStartLogging() |
boolean |
isTrace() |
boolean |
isUseQueueForAccept() |
protected String |
resolveHostName(ServerSocket socket,
InetAddress bindAddress) |
void |
run()
pull Sockets from the ServerSocket
|
void |
setAllowLinkStealing(boolean allowLinkStealing) |
void |
setBacklog(int backlog) |
void |
setBrokerInfo(BrokerInfo brokerInfo)
Associates a broker info with the transport server so that the transport can do discovery advertisements of the
broker.
|
void |
setConnectionTimeout(int connectionTimeout) |
void |
setDynamicManagement(boolean useJmx) |
void |
setJmxPort(int jmxPort) |
void |
setLogWriterName(String logFormat) |
void |
setMaximumConnections(int maximumConnections) |
void |
setMaxInactivityDuration(long maxInactivityDuration) |
void |
setMaxInactivityDurationInitalDelay(long maxInactivityDurationInitalDelay) |
void |
setMinmumWireFormatVersion(int minmumWireFormatVersion) |
void |
setSocketBufferSize(int socketBufferSize) |
void |
setSoTimeout(int soTimeout) |
void |
setStartLogging(boolean startLogging) |
void |
setTrace(boolean trace) |
void |
setUseQueueForAccept(boolean useQueueForAccept) |
void |
setWireFormatFactory(WireFormatFactory wireFormatFactory) |
void |
started(Service service) |
void |
stopped(Service service) |
String |
toString() |
getStackSize, isDaemon, isJoinOnStop, setDaemon, setJoinOnStop, setStackSizegetAcceptListener, getBindLocation, getConnectURI, onAcceptError, setAcceptListener, setBindLocation, setConnectURI, setTransportOptionaddServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stopprotected volatile ServerSocket serverSocket
protected int backlog
protected WireFormatFactory wireFormatFactory
protected final TcpTransportFactory transportFactory
protected long maxInactivityDuration
protected long maxInactivityDurationInitalDelay
protected int minmumWireFormatVersion
protected boolean useQueueForAccept
protected boolean allowLinkStealing
protected boolean verifyHostName
protected boolean trace
protected int soTimeout
protected int socketBufferSize
protected int connectionTimeout
protected String logWriterName
protected boolean dynamicManagement
protected boolean startLogging
protected int jmxPort
protected final ServerSocketFactory serverSocketFactory
protected final BlockingQueue<Socket> socketQueue
protected Thread socketHandlerThread
protected int maximumConnections
protected final AtomicInteger currentTransportCount
public TcpTransportServer(TcpTransportFactory transportFactory, URI location, ServerSocketFactory serverSocketFactory) throws IOException, URISyntaxException
IOExceptionURISyntaxExceptionpublic void bind() throws IOException
IOExceptionpublic WireFormatFactory getWireFormatFactory()
public void setWireFormatFactory(WireFormatFactory wireFormatFactory)
wireFormatFactory - The wireFormatFactory to set.public void setBrokerInfo(BrokerInfo brokerInfo)
setBrokerInfo in interface TransportServerbrokerInfo - public long getMaxInactivityDuration()
public void setMaxInactivityDuration(long maxInactivityDuration)
public long getMaxInactivityDurationInitalDelay()
public void setMaxInactivityDurationInitalDelay(long maxInactivityDurationInitalDelay)
public int getMinmumWireFormatVersion()
public void setMinmumWireFormatVersion(int minmumWireFormatVersion)
public boolean isTrace()
public void setTrace(boolean trace)
public String getLogWriterName()
public void setLogWriterName(String logFormat)
public boolean isDynamicManagement()
public void setDynamicManagement(boolean useJmx)
public void setJmxPort(int jmxPort)
public int getJmxPort()
public boolean isStartLogging()
public void setStartLogging(boolean startLogging)
public int getBacklog()
public void setBacklog(int backlog)
backlog - the backlog to setpublic boolean isUseQueueForAccept()
public void setUseQueueForAccept(boolean useQueueForAccept)
useQueueForAccept - the useQueueForAccept to setprotected Transport createTransport(Socket socket, WireFormat format) throws IOException
socket - format - IOExceptionprotected String resolveHostName(ServerSocket socket, InetAddress bindAddress) throws UnknownHostException
socket - bindAddress - UnknownHostExceptionprotected void doStart() throws Exception
doStart in class TransportServerThreadSupportExceptionprotected void doStop(ServiceStopper stopper) throws Exception
doStop in class TransportServerThreadSupportExceptionpublic InetSocketAddress getSocketAddress()
getSocketAddress in interface TransportServerprotected void handleSocket(Socket socket)
protected final void doHandleSocket(Socket socket)
protected TcpTransportServer.TransportInfo configureTransport(TcpTransportServer server, Socket socket) throws Exception
Exceptionpublic int getSoTimeout()
public void setSoTimeout(int soTimeout)
public int getSocketBufferSize()
public void setSocketBufferSize(int socketBufferSize)
public int getConnectionTimeout()
public void setConnectionTimeout(int connectionTimeout)
public int getMaximumConnections()
public void setMaximumConnections(int maximumConnections)
maximumConnections - the maximumConnections to setpublic AtomicInteger getCurrentTransportCount()
public void started(Service service)
started in interface ServiceListenerpublic void stopped(Service service)
stopped in interface ServiceListenerpublic boolean isSslServer()
TransportServerisSslServer in interface TransportServerpublic boolean isAllowLinkStealing()
TransportServerisAllowLinkStealing in interface TransportServerisAllowLinkStealing in class TransportServerSupportpublic void setAllowLinkStealing(boolean allowLinkStealing)
setAllowLinkStealing in class TransportServerSupportCopyright © 2005–2020 The Apache Software Foundation. All rights reserved.