public class ConnectionLimit
extends AbstractLifeCycle
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.Listener| Constructor and Description |
|---|
ConnectionLimit(int maxConnections,
Connector... connectors) |
ConnectionLimit(int maxConnections,
Server server) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doStart() |
protected void |
doStop() |
int |
getConnections() |
int |
getMaxConnections() |
void |
onClosed(Connection connection) |
void |
onOpened(Connection connection) |
void |
setMaxConnections(int max) |
public ConnectionLimit(int maxConnections,
Server server)
public ConnectionLimit(int maxConnections,
Connector... connectors)
public int getMaxConnections()
public void setMaxConnections(int max)
public int getConnections()
protected void doStart()
throws java.lang.Exception
java.lang.Exceptionprotected void doStop()
throws java.lang.Exception
java.lang.Exceptionpublic void onOpened(Connection connection)
public void onClosed(Connection connection)