public abstract class AbstractServerConnector extends AbstractMessageConnector implements MessageConnector.Bindable, ServerConnectorMBean
AbstractMessageConnector.Joinable
MessageConnector.Bindable
Modifier and Type | Field and Description |
---|---|
protected boolean |
active |
protected InetAddress |
bindAddress |
protected String |
bindAddressString |
protected int |
maxConnections |
protected int |
port |
log
ANY_BIND_ADDRESS
Modifier | Constructor and Description |
---|---|
protected |
AbstractServerConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory)
Constructs new abstract message connector.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
cancelScheduledTask() |
String |
closeConnections(double percent,
String period,
boolean stopAcceptor)
Smooth closing a percent of connections during a specified period.
|
String |
getAddress()
Address string of connector.
|
String |
getBindAddr()
Network interface address to bind socket to
|
InetAddress |
getBindInetAddress() |
protected abstract List<Closeable> |
getConnections() |
int |
getLocalPort()
Local TCP/IP port
|
int |
getMaxConnections()
Max number of connections
|
boolean |
isActive()
True when connector is active (started).
|
void |
setBindAddr(String newBindAddress) |
void |
setLocalPort(int port) |
void |
setMaxConnections(int maxConnections) |
void |
start()
Starts connector (connection is immediately established).
|
protected abstract void |
startAcceptorInternal() |
protected abstract void |
startImpl(boolean startAcceptor) |
void |
stopAcceptor()
Stop accepting new connections
|
protected abstract boolean |
stopAcceptorInternal() |
String |
stopGracefully(String period)
Stopping server socket acceptor and smooth closing of all connections during a specified period
|
addClosedConnectionStats, addMessageConnectorListener, close, closeImpl, getClosedConnectionCount, getEndpointStats, getFactory, getFieldReplacer, getLogging, getName, getPassword, getReconnectDelay, getStats, getThreadPriority, getUser, handlerClosed, isClosed, notifyMessageConnectorListeners, reconfigure, reconnect, removeMessageConnectorListener, resetEndpointStats, restart, restartImpl, retrieveCompleteEndpointStats, setFactory, setFieldReplacer, setName, setPassword, setReconnectDelay, setStats, setThreadPriority, setUser, stop, stopAndWait, stopImpl, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
normalizeBindAddr
isAccepting
getConnectionCount, getEndpointStats, getFieldReplacer, getName, getPassword, getReconnectDelay, getState, getThreadPriority, getUser, reconnect, resetEndpointStats, restart, retrieveCompleteEndpointStats, setFieldReplacer, setName, setPassword, setReconnectDelay, setThreadPriority, setUser, stop
awaitProcessed
protected volatile boolean active
protected volatile int port
protected volatile InetAddress bindAddress
protected volatile String bindAddressString
protected volatile int maxConnections
protected AbstractServerConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory)
factory
- application connection factory to useNullPointerException
- if factory
is null
public void start()
MessageConnectorMBean
start
in interface MessageConnectorMBean
start
in class AbstractMessageConnector
public boolean isActive()
MessageConnectorMBean
isActive
in interface MessageConnectorMBean
public int getLocalPort()
ServerConnectorMBean
getLocalPort
in interface ServerConnectorMBean
public void setLocalPort(int port)
setLocalPort
in interface ServerConnectorMBean
public String getAddress()
MessageConnectorMBean
getAddress
in interface MessageConnectorMBean
public String getBindAddr()
ServerConnectorMBean
getBindAddr
in interface MessageConnector.Bindable
getBindAddr
in interface ServerConnectorMBean
public InetAddress getBindInetAddress()
public void setBindAddr(String newBindAddress) throws UnknownHostException
setBindAddr
in interface MessageConnector.Bindable
setBindAddr
in interface ServerConnectorMBean
UnknownHostException
public int getMaxConnections()
ServerConnectorMBean
getMaxConnections
in interface ServerConnectorMBean
public void setMaxConnections(int maxConnections)
setMaxConnections
in interface ServerConnectorMBean
public String closeConnections(double percent, String period, boolean stopAcceptor)
closeConnections
in interface ServerConnectorMBean
percent
- of connections which will be closed gracefullyperiod
- period in TimePeriod formatstopAcceptor
- true if acceptor must be disabled for a specified periodpublic String stopGracefully(String period)
stopGracefully
in interface ServerConnectorMBean
period
- period in TimePeriod formatpublic void stopAcceptor()
ServerConnectorMBean
stopAcceptor
in interface ServerConnectorMBean
protected abstract void startImpl(boolean startAcceptor)
protected abstract boolean stopAcceptorInternal()
protected abstract void startAcceptorInternal()
protected boolean cancelScheduledTask()
Copyright © 2002–2025 Devexperts LLC. All rights reserved.