public abstract class AbstractServerConnector extends AbstractMessageConnector implements MessageConnector.Bindable, ServerConnectorMBean
AbstractMessageConnector.JoinableMessageConnector.Bindable| Modifier and Type | Field and Description |
|---|---|
protected boolean |
active |
protected InetAddress |
bindAddress |
protected String |
bindAddressString |
protected int |
maxConnections |
protected int |
port |
logANY_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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitnormalizeBindAddrisAcceptinggetConnectionCount, getEndpointStats, getFieldReplacer, getName, getPassword, getReconnectDelay, getState, getThreadPriority, getUser, reconnect, resetEndpointStats, restart, retrieveCompleteEndpointStats, setFieldReplacer, setName, setPassword, setReconnectDelay, setThreadPriority, setUser, stopawaitProcessedprotected 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 nullpublic void start()
MessageConnectorMBeanstart in interface MessageConnectorMBeanstart in class AbstractMessageConnectorpublic boolean isActive()
MessageConnectorMBeanisActive in interface MessageConnectorMBeanpublic int getLocalPort()
ServerConnectorMBeangetLocalPort in interface ServerConnectorMBeanpublic void setLocalPort(int port)
setLocalPort in interface ServerConnectorMBeanpublic String getAddress()
MessageConnectorMBeangetAddress in interface MessageConnectorMBeanpublic String getBindAddr()
ServerConnectorMBeangetBindAddr in interface MessageConnector.BindablegetBindAddr in interface ServerConnectorMBeanpublic InetAddress getBindInetAddress()
public void setBindAddr(String newBindAddress) throws UnknownHostException
setBindAddr in interface MessageConnector.BindablesetBindAddr in interface ServerConnectorMBeanUnknownHostExceptionpublic int getMaxConnections()
ServerConnectorMBeangetMaxConnections in interface ServerConnectorMBeanpublic void setMaxConnections(int maxConnections)
setMaxConnections in interface ServerConnectorMBeanpublic String closeConnections(double percent, String period, boolean stopAcceptor)
closeConnections in interface ServerConnectorMBeanpercent - 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 ServerConnectorMBeanperiod - period in TimePeriod formatpublic void stopAcceptor()
ServerConnectorMBeanstopAcceptor in interface ServerConnectorMBeanprotected abstract void startImpl(boolean startAcceptor)
protected abstract boolean stopAcceptorInternal()
protected abstract void startAcceptorInternal()
protected boolean cancelScheduledTask()
Copyright © 2002–2025 Devexperts LLC. All rights reserved.