@MessageConnectorSummary(info="Creates server TCP/IP socket connection.", addressFormat=":<port>") public class ServerSocketConnector extends AbstractMessageConnector implements ServerSocketConnectorMBean
ServerSocketConnector
handles standard server socket using blocking API.AbstractMessageConnector.Joinable
Modifier and Type | Field and Description |
---|---|
protected com.devexperts.qd.qtp.socket.SocketAcceptor |
acceptor |
protected InetAddress |
bindAddr |
protected String |
bindAddrString |
protected SocketHandler.CloseListener |
closeListener |
protected Set<com.devexperts.qd.qtp.socket.SocketHandler> |
handlers |
protected int |
maxConnections |
protected int |
port |
protected boolean |
useTls |
log
Constructor and Description |
---|
ServerSocketConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory,
int port)
Creates new server socket connector.
|
ServerSocketConnector(MessageAdapter.Factory factory,
int port)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addHandler(com.devexperts.qd.qtp.socket.SocketHandler handler) |
String |
getAddress()
Address string of connector.
|
String |
getBindAddr()
Network interface address to bind socket to
|
int |
getConnectionCount()
Number of established connections
|
int |
getLocalPort()
Local TCP/IP port
|
int |
getMaxConnections()
Max number of connections
|
MessageConnectorState |
getState()
State of connector.
|
boolean |
getTls() |
protected void |
handlerClosed(com.devexperts.qd.qtp.socket.SocketHandler handler) |
boolean |
isActive()
True when connector is active (started).
|
protected boolean |
isNewConnectionAllowed() |
com.devexperts.transport.stats.EndpointStats |
retrieveCompleteEndpointStats()
Retrieves endpoint statistics for this message connector since its creation
|
void |
setBindAddr(String bindAddrString) |
void |
setLocalPort(int port)
Changes local port and restarts connector
if new port is different from the old one and the connector was running.
|
void |
setMaxConnections(int maxConnections) |
void |
setStats(QDStats stats)
Sets stats for this connector.
|
void |
setTls(boolean useTls) |
void |
start()
Starts connector (connection is immediately established).
|
protected AbstractMessageConnector.Joinable |
stopImpl() |
addClosedConnectionStats, addMessageConnectorListener, getClosedConnectionCount, getEndpointStats, getFactory, getLogging, getName, getPassword, getReconnectDelay, getStats, getThreadPriority, getUser, handlerClosed, notifyMessageConnectorListeners, reconfigure, reconnect, removeMessageConnectorListener, resetEndpointStats, restart, restartImpl, setFactory, setName, setPassword, setReconnectDelay, setThreadPriority, setUser, stop, stopAndWait, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEndpointStats, getName, getPassword, getReconnectDelay, getThreadPriority, getUser, reconnect, resetEndpointStats, restart, setName, setPassword, setReconnectDelay, setThreadPriority, setUser, stop
awaitProcessed
protected int port
protected String bindAddrString
protected InetAddress bindAddr
protected boolean useTls
protected int maxConnections
protected final Set<com.devexperts.qd.qtp.socket.SocketHandler> handlers
protected final SocketHandler.CloseListener closeListener
protected volatile com.devexperts.qd.qtp.socket.SocketAcceptor acceptor
@Deprecated public ServerSocketConnector(MessageAdapter.Factory factory, int port)
ServerSocketConnector(ApplicationConnectionFactory, int)
factory
- message adapter factory to useport
- TCP port to useNullPointerException
- if factory
is null
public ServerSocketConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory, int port)
factory
- application connection factory to useport
- TCP port to useNullPointerException
- if factory
is null
public String getAddress()
MessageConnectorMBean
getAddress
in interface MessageConnectorMBean
public void setLocalPort(int port)
setLocalPort
in interface ServerSocketConnectorMBean
public int getLocalPort()
ServerSocketConnectorMBean
getLocalPort
in interface ServerSocketConnectorMBean
public String getBindAddr()
ServerSocketConnectorMBean
getBindAddr
in interface ServerSocketConnectorMBean
public void setBindAddr(String bindAddrString) throws UnknownHostException
setBindAddr
in interface ServerSocketConnectorMBean
UnknownHostException
public int getMaxConnections()
ServerSocketConnectorMBean
getMaxConnections
in interface ServerSocketConnectorMBean
public void setMaxConnections(int maxConnections)
setMaxConnections
in interface ServerSocketConnectorMBean
public boolean getTls()
public void setTls(boolean useTls)
public void setStats(QDStats stats)
QDStats.SType#SERVER_SOCKET_CONNECTOR
or
a suitable substitute. This method may be invoked only once.setStats
in interface MessageConnector
setStats
in class AbstractMessageConnector
IllegalStateException
- if already set.public boolean isActive()
MessageConnectorMBean
isActive
in interface MessageConnectorMBean
public MessageConnectorState getState()
MessageConnectorMBean
getState
in interface MessageConnectorMBean
public int getConnectionCount()
MessageConnectorMBean
getConnectionCount
in interface MessageConnectorMBean
public com.devexperts.transport.stats.EndpointStats retrieveCompleteEndpointStats()
MessageConnectorMBean
retrieveCompleteEndpointStats
in interface MessageConnectorMBean
retrieveCompleteEndpointStats
in class AbstractMessageConnector
public void start()
MessageConnectorMBean
start
in interface MessageConnectorMBean
start
in class AbstractMessageConnector
protected AbstractMessageConnector.Joinable stopImpl()
stopImpl
in class AbstractMessageConnector
protected void addHandler(com.devexperts.qd.qtp.socket.SocketHandler handler)
protected void handlerClosed(com.devexperts.qd.qtp.socket.SocketHandler handler)
protected boolean isNewConnectionAllowed()
Copyright © 2002-2020 Devexperts LLC. All Rights Reserved.