Class ConnectionLimit

All Implemented Interfaces:
EventListener, Connection.Listener, SelectorManager.AcceptListener, SelectorManager.SelectorManagerListener, LifeCycle

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: