public class TcpTransportServer extends TransportServerThreadSupport implements ServiceListener
TransportServer
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 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 SelectorSelection |
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 WireFormatFactory |
wireFormatFactory |
transportOptions
Constructor and Description |
---|
TcpTransportServer(TcpTransportFactory transportFactory,
URI location,
ServerSocketFactory serverSocketFactory) |
Modifier and Type | Method and Description |
---|---|
void |
bind() |
protected Transport |
createTransport(Socket socket,
WireFormat format)
Allow derived classes to override the Transport implementation that this transport server creates.
|
protected void |
doStart() |
protected void |
doStop(ServiceStopper stopper) |
int |
getBacklog() |
int |
getConnectionTimeout() |
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 |
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, setStackSize
getAcceptListener, getBindLocation, getConnectURI, onAcceptError, setAcceptListener, setBindLocation, setConnectURI, setTransportOption
addServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stop
protected ServerSocket serverSocket
protected SelectorSelection selector
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 trace
protected int soTimeout
protected int socketBufferSize
protected int connectionTimeout
protected String logWriterName
protected boolean dynamicManagement
protected boolean startLogging
protected final ServerSocketFactory serverSocketFactory
protected BlockingQueue<Socket> socketQueue
protected Thread socketHandlerThread
protected int maximumConnections
protected AtomicInteger currentTransportCount
public TcpTransportServer(TcpTransportFactory transportFactory, URI location, ServerSocketFactory serverSocketFactory) throws IOException, URISyntaxException
IOException
URISyntaxException
public void bind() throws IOException
IOException
public WireFormatFactory getWireFormatFactory()
public void setWireFormatFactory(WireFormatFactory wireFormatFactory)
wireFormatFactory
- The wireFormatFactory to set.public void setBrokerInfo(BrokerInfo brokerInfo)
setBrokerInfo
in interface TransportServer
brokerInfo
- 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 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
- IOException
protected String resolveHostName(ServerSocket socket, InetAddress bindAddress) throws UnknownHostException
socket
- bindAddress
- UnknownHostException
protected void doStart() throws Exception
doStart
in class TransportServerThreadSupport
Exception
protected void doStop(ServiceStopper stopper) throws Exception
doStop
in class TransportServerThreadSupport
Exception
public InetSocketAddress getSocketAddress()
getSocketAddress
in interface TransportServer
protected final void handleSocket(Socket socket)
public 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 void started(Service service)
started
in interface ServiceListener
public void stopped(Service service)
stopped
in interface ServiceListener
public boolean isSslServer()
TransportServer
isSslServer
in interface TransportServer
public boolean isAllowLinkStealing()
TransportServer
isAllowLinkStealing
in interface TransportServer
isAllowLinkStealing
in class TransportServerSupport
public void setAllowLinkStealing(boolean allowLinkStealing)
setAllowLinkStealing
in class TransportServerSupport
Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.