Connection.Listener, LifeCycle@ManagedObject public class ConnectionLimit extends AbstractLifeCycle implements Connection.Listener
A Connection 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.
Connection.ListenerAbstractLifeCycle.AbstractLifeCycleListenerConnection.Listener.AdapterLifeCycle.ListenerFAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING| Constructor | Description |
|---|---|
ConnectionLimit(int maxConnections,
Connector... connectors) |
|
ConnectionLimit(int maxConnections,
Server server) |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
doStart() |
|
protected void |
doStop() |
|
int |
getConnections() |
|
int |
getMaxConnections() |
|
void |
onClosed(Connection connection) |
|
void |
onOpened(Connection connection) |
|
void |
setMaxConnections(int max) |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stoppublic ConnectionLimit(int maxConnections,
Server server)
public ConnectionLimit(int maxConnections,
Connector... connectors)
@ManagedAttribute("The maximum number of connections allowed") public int getMaxConnections()
public void setMaxConnections(int max)
@ManagedAttribute("The current number of connections ") public int getConnections()
protected void doStart()
throws java.lang.Exception
doStart in class AbstractLifeCyclejava.lang.Exceptionprotected void doStop()
throws java.lang.Exception
doStop in class AbstractLifeCyclejava.lang.Exceptionpublic void onOpened(Connection connection)
onOpened in interface Connection.Listenerpublic void onClosed(Connection connection)
onClosed in interface Connection.ListenerCopyright © 1995–2018 Webtide. All rights reserved.