Package org.eclipse.jetty.server
Class ConnectionLimit
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.server.ConnectionLimit
-
- All Implemented Interfaces:
java.util.EventListener,Connection.Listener,SelectorManager.AcceptListener,LifeCycle
@ManagedObject @Deprecated(since="2021-05-27") public class ConnectionLimit extends AbstractLifeCycle implements Connection.Listener, SelectorManager.AcceptListener
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.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. It can be applied to an entire server or to a specific connector by adding it viaContainer.addBean(Object)Usage:
Server server = new Server(); server.addBean(new ConnectionLimit(5000,server)); ... server.start();
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection.Listener
Connection.Listener.Adapter
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Constructor Summary
Constructors Constructor Description ConnectionLimit(int maxConnections, Connector... connectors)Deprecated.ConnectionLimit(int maxConnections, Server server)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intgetConnections()Deprecated.longgetIdleTimeout()Deprecated.intgetMaxConnections()Deprecated.voidonAccepted(java.nio.channels.SelectableChannel channel)Deprecated.Called after the accepted channel has been allocated anEndPointand associatedConnection, and after the onOpen notifications have been called on both endPoint and connection.voidonAcceptFailed(java.nio.channels.SelectableChannel channel, java.lang.Throwable cause)Deprecated.Called if the processing of the accepted channel fails prior to callingSelectorManager.AcceptListener.onAccepted(SelectableChannel).voidonAccepting(java.nio.channels.SelectableChannel channel)Deprecated.Called immediately after a new SelectableChannel is accepted, but before it has been submitted to theSelectorManager.voidonClosed(Connection connection)Deprecated.voidonOpened(Connection connection)Deprecated.voidsetIdleTimeout(long idleTimeout)Deprecated.voidsetMaxConnections(int max)Deprecated.-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop, toString
-
-
-
-
Method Detail
-
getIdleTimeout
@ManagedAttribute("The endpoint idle timeout in ms to apply when the connection limit is reached") public long getIdleTimeout()
Deprecated.- Returns:
- If >= 0, the endpoint idle timeout in ms to apply when the connection limit is reached
-
setIdleTimeout
public void setIdleTimeout(long idleTimeout)
Deprecated.- Parameters:
idleTimeout- If >= 0 the endpoint idle timeout in ms to apply when the connection limit is reached
-
getMaxConnections
@ManagedAttribute("The maximum number of connections allowed") public int getMaxConnections()
Deprecated.
-
setMaxConnections
public void setMaxConnections(int max)
Deprecated.
-
getConnections
@ManagedAttribute("The current number of connections ") public int getConnections()
Deprecated.
-
onAccepting
public void onAccepting(java.nio.channels.SelectableChannel channel)
Deprecated.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
public void onAcceptFailed(java.nio.channels.SelectableChannel channel, java.lang.Throwable cause)Deprecated.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
public void onAccepted(java.nio.channels.SelectableChannel channel)
Deprecated.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
public void onOpened(Connection connection)
Deprecated.- Specified by:
onOpenedin interfaceConnection.Listener
-
onClosed
public void onClosed(Connection connection)
Deprecated.- Specified by:
onClosedin interfaceConnection.Listener
-
-