Class ConnectionLimit
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.server.ConnectionLimit
- All Implemented Interfaces:
 EventListener, Connection.Listener, SelectorManager.AcceptListener, SelectorManager.SelectorManagerListener, LifeCycle
@Deprecated(forRemoval=true,
            since="12.0.24")
@ManagedObject
public class ConnectionLimit
extends AbstractLifeCycle
implements Connection.Listener, SelectorManager.AcceptListener
Deprecated, for removal: This API element is subject to removal in a future version.
A Listener that limits the number of Connections.
This listener applies a limit to the number of connections, which when
exceeded results in  a call to AbstractConnector.setAccepting(boolean)
to prevent further connections being received.
This listener can be applied to an entire Server or to a specific
Connector by adding it via Container.addBean(Object).
When the number of connections is exceeded, the idle timeout of existing connections is changed with the value configured in this listener (typically a shorter value).
Usage:
  Server server = new Server();
  server.addBean(new ConnectionLimit(5000,server));
  ...
  server.start();
- See Also:
 
- 
Nested Class Summary
Nested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface LifeCycle
LifeCycle.Listener - 
Field Summary
 - 
Constructor Summary
ConstructorsConstructorDescriptionConnectionLimit(int maxConnections, Connector... connectors) Deprecated, for removal: This API element is subject to removal in a future version.ConnectionLimit(int maxConnections, Server server) Deprecated, for removal: This API element is subject to removal in a future version. - 
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoStart()Deprecated, for removal: This API element is subject to removal in a future version.Method to override to start the lifecycleprotected voiddoStop()Deprecated, for removal: This API element is subject to removal in a future version.Method to override to stop the lifecycleintDeprecated, for removal: This API element is subject to removal in a future version.longDeprecated, for removal: This API element is subject to removal in a future version.intDeprecated, for removal: This API element is subject to removal in a future version.intDeprecated, for removal: This API element is subject to removal in a future version.protected voidlimit()Deprecated, for removal: This API element is subject to removal in a future version.voidonAccepted(SelectableChannel channel) Deprecated, for removal: This API element is subject to removal in a future version.Called after the accepted channel has been allocated anEndPointand associatedConnection, and after the onOpen notifications have been called on both endPoint and connection.voidonAcceptFailed(SelectableChannel channel, Throwable cause) Deprecated, for removal: This API element is subject to removal in a future version.Called if the processing of the accepted channel fails prior to callingSelectorManager.AcceptListener.onAccepted(SelectableChannel).voidonAccepting(SelectableChannel channel) Deprecated, for removal: This API element is subject to removal in a future version.Called immediately after a new SelectableChannel is accepted, but before it has been submitted to theSelectorManager.voidonClosed(Connection connection) Deprecated, for removal: This API element is subject to removal in a future version.voidonOpened(Connection connection) Deprecated, for removal: This API element is subject to removal in a future version.voidsetIdleTimeout(long idleTimeout) Deprecated, for removal: This API element is subject to removal in a future version.Sets the endpoint idle timeout in ms to apply when the connection limit is reached.voidsetMaxConnections(int max) Deprecated, for removal: This API element is subject to removal in a future version.protected voidunlimit()Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class AbstractLifeCycle
addEventListener, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stop, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface SelectorManager.AcceptListener
onClosed 
- 
Constructor Details
- 
ConnectionLimit
 - 
ConnectionLimit
 
 - 
 - 
Method Details
- 
getIdleTimeout
@ManagedAttribute("The endpoint idle timeout in ms to apply when the connection limit is reached") public long getIdleTimeout()Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
 - the endpoint idle timeout in ms to apply when the connection limit is reached
 
 - 
setIdleTimeout
public void setIdleTimeout(long idleTimeout) Deprecated, for removal: This API element is subject to removal in a future version.Sets the endpoint idle timeout in ms to apply when the connection limit is reached.
A value less than or equal to zero will not change the existing idle timeout.
- Parameters:
 idleTimeout- the endpoint idle timeout in ms to apply when the connection limit is reached
 - 
getMaxConnections
Deprecated, for removal: This API element is subject to removal in a future version. - 
setMaxConnections
public void setMaxConnections(int max) Deprecated, for removal: This API element is subject to removal in a future version. - 
getConnections
@ManagedAttribute(value="The current number of connections", readonly=true) public int getConnections()Deprecated, for removal: This API element is subject to removal in a future version. - 
getPendingConnections
@ManagedAttribute(value="The current number of pending connections", readonly=true) public int getPendingConnections()Deprecated, for removal: This API element is subject to removal in a future version. - 
doStart
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractLifeCycleMethod to override to start the lifecycle- Overrides:
 doStartin classAbstractLifeCycle- Throws:
 Exception- If there was a problem starting. Will cause a transition to FAILED state
 - 
doStop
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractLifeCycleMethod to override to stop the lifecycle- Overrides:
 doStopin classAbstractLifeCycle- Throws:
 Exception- If there was a problem stopping. Will cause a transition to FAILED state
 - 
limit
protected void limit()Deprecated, for removal: This API element is subject to removal in a future version. - 
unlimit
protected void unlimit()Deprecated, for removal: This API element is subject to removal in a future version. - 
onAccepting
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:SelectorManager.AcceptListenerCalled immediately after a new SelectableChannel is accepted, but before it has been submitted to theSelectorManager.- Specified by:
 onAcceptingin interfaceSelectorManager.AcceptListener- Parameters:
 channel- the accepted channel
 - 
onAcceptFailed
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:SelectorManager.AcceptListenerCalled if the processing of the accepted channel fails prior to callingSelectorManager.AcceptListener.onAccepted(SelectableChannel).- Specified by:
 onAcceptFailedin interfaceSelectorManager.AcceptListener- Parameters:
 channel- the accepted channelcause- the cause of the failure
 - 
onAccepted
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:SelectorManager.AcceptListenerCalled after the accepted channel has been allocated anEndPointand associatedConnection, and after the onOpen notifications have been called on both endPoint and connection.- Specified by:
 onAcceptedin interfaceSelectorManager.AcceptListener- Parameters:
 channel- the accepted channel
 - 
onOpened
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
 onOpenedin interfaceConnection.Listener
 - 
onClosed
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
 onClosedin interfaceConnection.Listener
 
 - 
 
NetworkConnectionLimitinstead