@ManagedObject(value="AbstractNetworkConnector") public abstract class AbstractNetworkConnector extends AbstractConnector implements NetworkConnector
Extends the AbstractConnector support for the NetworkConnector interface.
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.ListenerContainer.InheritedListener, Container.Listener| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
_host |
private int |
_port |
LOGFAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING| Constructor and Description |
|---|
AbstractNetworkConnector(Server server,
java.util.concurrent.Executor executor,
Scheduler scheduler,
ByteBufferPool pool,
int acceptors,
ConnectionFactory... factories) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Performs the activities needed to close the network communication
(for example, to stop accepting network connections).
|
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
java.lang.String |
getHost() |
int |
getLocalPort() |
int |
getPort() |
protected boolean |
handleAcceptFailure(java.lang.Throwable ex) |
void |
open()
Performs the activities needed to open the network communication
(for example, to start accepting incoming network connections).
|
void |
setHost(java.lang.String host) |
void |
setPort(int port) |
java.util.concurrent.Future<java.lang.Void> |
shutdown() |
java.lang.String |
toString() |
accept, addConnectionFactory, addFirstConnectionFactory, addIfAbsentConnectionFactory, clearConnectionFactories, getAcceptorPriorityDelta, getAcceptors, getByteBufferPool, getConnectedEndPoints, getConnectionFactories, getConnectionFactory, getConnectionFactory, getDefaultConnectionFactory, getDefaultProtocol, getExecutor, getIdleTimeout, getName, getProtocols, getScheduler, getServer, interruptAcceptors, isAccepting, join, join, onEndPointClosed, onEndPointOpened, removeConnectionFactory, setAccepting, setAcceptorPriorityDelta, setConnectionFactories, setDefaultProtocol, setIdleTimeout, setNameaddBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisOpengetByteBufferPool, getConnectedEndPoints, getConnectionFactories, getConnectionFactory, getConnectionFactory, getDefaultConnectionFactory, getExecutor, getIdleTimeout, getName, getProtocols, getScheduler, getServer, getTransportaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, start, stop, stopaddBean, addBean, addEventListener, getBean, getBeans, getBeans, getContainedBeans, isManaged, manage, removeBean, removeEventListener, unmanagepublic AbstractNetworkConnector(Server server, java.util.concurrent.Executor executor, Scheduler scheduler, ByteBufferPool pool, int acceptors, ConnectionFactory... factories)
public void setHost(java.lang.String host)
@ManagedAttribute(value="The network interface this connector binds to as an IP address or a hostname. If null or 0.0.0.0, then bind to all interfaces.") public java.lang.String getHost()
getHost in interface NetworkConnectorpublic void setPort(int port)
@ManagedAttribute(value="Port this connector listens on. If set the 0 a random port is assigned which may be obtained with getLocalPort()") public int getPort()
getPort in interface NetworkConnectorpublic int getLocalPort()
getLocalPort in interface NetworkConnectorprotected void doStart()
throws java.lang.Exception
ContainerLifeCycledoStart in class AbstractConnectorjava.lang.Exceptionprotected void doStop()
throws java.lang.Exception
ContainerLifeCycledoStop in class AbstractConnectorjava.lang.Exceptionpublic void open()
throws java.io.IOException
NetworkConnectorPerforms the activities needed to open the network communication (for example, to start accepting incoming network connections).
open in interface NetworkConnectorjava.io.IOException - if this connector cannot be openedNetworkConnector.close()public void close()
NetworkConnectorPerforms the activities needed to close the network communication (for example, to stop accepting network connections).
Once a connector has been closed, it cannot be opened again without first callingLifeCycle.stop() and it will not be active again until a subsequent call to LifeCycle.start()close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface NetworkConnectorpublic java.util.concurrent.Future<java.lang.Void> shutdown()
shutdown in interface Gracefulshutdown in class AbstractConnectorprotected boolean handleAcceptFailure(java.lang.Throwable ex)
handleAcceptFailure in class AbstractConnectorpublic java.lang.String toString()
toString in class AbstractConnector