java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.server.AbstractConnector
org.eclipse.jetty.server.AbstractNetworkConnector
- All Implemented Interfaces:
Closeable,AutoCloseable,Connector,NetworkConnector,org.eclipse.jetty.util.component.Container,org.eclipse.jetty.util.component.Destroyable,org.eclipse.jetty.util.component.Dumpable,org.eclipse.jetty.util.component.Dumpable.DumpableContainer,org.eclipse.jetty.util.component.Graceful,org.eclipse.jetty.util.component.LifeCycle
- Direct Known Subclasses:
ServerConnector
@ManagedObject("AbstractNetworkConnector")
public abstract class AbstractNetworkConnector
extends AbstractConnector
implements NetworkConnector
An abstract Network Connector.
Extends the AbstractConnector support for the NetworkConnector interface.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Graceful
org.eclipse.jetty.util.component.Graceful.Shutdown, org.eclipse.jetty.util.component.Graceful.ThrowingRunnableNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener -
Field Summary
Fields inherited from class org.eclipse.jetty.server.AbstractConnector
LOGFields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY -
Constructor Summary
ConstructorsConstructorDescriptionAbstractNetworkConnector(Server server, Executor executor, org.eclipse.jetty.util.thread.Scheduler scheduler, org.eclipse.jetty.io.ByteBufferPool pool, int acceptors, ConnectionFactory... factories) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Performs the activities needed to close the network communication (for example, to stop accepting network connections).protected voiddoStart()protected voiddoStop()getHost()intintgetPort()protected booleanvoidopen()Performs the activities needed to open the network communication (for example, to start accepting incoming network connections).voidvoidsetPort(int port) shutdown()toString()Methods inherited from class org.eclipse.jetty.server.AbstractConnector
accept, addConnectionFactory, addFirstConnectionFactory, addIfAbsentConnectionFactory, clearConnectionFactories, getAcceptorPriorityDelta, getAcceptors, getByteBufferPool, getConnectedEndPoints, getConnectionFactories, getConnectionFactory, getConnectionFactory, getDefaultConnectionFactory, getDefaultProtocol, getExecutor, getHttpChannelListeners, getIdleTimeout, getName, getProtocols, getScheduler, getServer, getShutdownIdleTimeout, interruptAcceptors, isAccepting, isShutdown, join, join, onEndPointClosed, onEndPointOpened, removeConnectionFactory, setAccepting, setAcceptorPriorityDelta, setConnectionFactories, setDefaultProtocol, setIdleTimeout, setName, setShutdownIdleTimeoutMethods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.server.Connector
getByteBufferPool, getConnectedEndPoints, getConnectionFactories, getConnectionFactory, getConnectionFactory, getDefaultConnectionFactory, getExecutor, getIdleTimeout, getName, getProtocols, getScheduler, getServer, getTransportMethods inherited from interface org.eclipse.jetty.util.component.Container
addBean, addBean, addEventListener, getBean, getBeans, getBeans, getCachedBeans, getContainedBeans, getEventListeners, isManaged, manage, removeBean, removeEventListener, unmanageMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dump, dumpSelfMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpableMethods inherited from interface org.eclipse.jetty.util.component.Graceful
isShutdownMethods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stopMethods inherited from interface org.eclipse.jetty.server.NetworkConnector
isOpen
-
Constructor Details
-
AbstractNetworkConnector
public AbstractNetworkConnector(Server server, Executor executor, org.eclipse.jetty.util.thread.Scheduler scheduler, org.eclipse.jetty.io.ByteBufferPool pool, int acceptors, ConnectionFactory... factories)
-
-
Method Details
-
setHost
-
getHost
@ManagedAttribute("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 String getHost()- Specified by:
getHostin interfaceNetworkConnector- Returns:
- The hostname representing the interface to which this connector will bind, or null for all interfaces.
-
setPort
public void setPort(int port) -
getPort
@ManagedAttribute("Port this connector listens on. If set the 0 a random port is assigned which may be obtained with getLocalPort()") public int getPort()- Specified by:
getPortin interfaceNetworkConnector- Returns:
- The configured port for the connector or 0 if any available port may be used.
-
getLocalPort
public int getLocalPort()- Specified by:
getLocalPortin interfaceNetworkConnector- Returns:
- The actual port the connector is listening on, or -1 if it has not been opened, or -2 if it has been closed.
-
doStart
- Overrides:
doStartin classAbstractConnector- Throws:
Exception
-
doStop
- Overrides:
doStopin classAbstractConnector- Throws:
Exception
-
open
Description copied from interface:NetworkConnectorPerforms the activities needed to open the network communication (for example, to start accepting incoming network connections).
- Specified by:
openin interfaceNetworkConnector- Throws:
IOException- if this connector cannot be opened- See Also:
-
close
public void close()Description copied from interface: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 toLifeCycle.start()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceNetworkConnector
-
shutdown
- Specified by:
shutdownin interfaceorg.eclipse.jetty.util.component.Graceful- Overrides:
shutdownin classAbstractConnector
-
handleAcceptFailure
- Overrides:
handleAcceptFailurein classAbstractConnector
-
toString
- Overrides:
toStringin classAbstractConnector
-