Module simplehttpserver
Class ServerExchangeThrottler
- java.lang.Object
-
- com.kttdevelopment.simplehttpserver.handler.ServerExchangeThrottler
-
public class ServerExchangeThrottler extends Object
Limits connections per address to the server and total server connections.- Since:
- 03.05.00
- Version:
- 03.05.01
- Author:
- Ktt Development
- See Also:
HttpExchange,ThrottledHandler,ExchangeThrottler,SessionThrottler,ServerSessionThrottler
-
-
Constructor Summary
Constructors Constructor Description ServerExchangeThrottler()Creates a throttler with connection limits on user and total connections.ServerExchangeThrottler(int maxConnections)Creates a throttler with connection limits on user and total connections.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanIgnoreConnectionLimit(HttpExchange exchange)Returns if an exchange is exempt from the server connection limit only.intgetMaxConnections(HttpExchange exchange)Returns the maximum number of connections for an exchange.intgetMaxServerConnections()Returns the maximum number of connections the server can have.voidsetMaxServerConnections(int connections)Sets the maximum number of connections the server can have.StringtoString()
-
-
-
Constructor Detail
-
ServerExchangeThrottler
public ServerExchangeThrottler()
Creates a throttler with connection limits on user and total connections.- Since:
- 03.05.00
-
ServerExchangeThrottler
public ServerExchangeThrottler(int maxConnections)
Creates a throttler with connection limits on user and total connections.- Parameters:
maxConnections- maximum allowed server connections- Since:
- 03.05.00
-
-
Method Detail
-
getMaxConnections
public int getMaxConnections(HttpExchange exchange)
Returns the maximum number of connections for an exchange. A value of-1means unlimited connections.- Parameters:
exchange- exchange to process- Returns:
- maximum number of connections allowed
- See Also:
HttpExchange,addConnection(HttpExchange),deleteConnection(HttpExchange)
-
canIgnoreConnectionLimit
public boolean canIgnoreConnectionLimit(HttpExchange exchange)
Returns if an exchange is exempt from the server connection limit only.- Parameters:
exchange- exchange to process- Returns:
- if exchange ignores server connection limit
- Since:
- 03.05.00
- See Also:
HttpExchange
-
setMaxServerConnections
public final void setMaxServerConnections(int connections)
Sets the maximum number of connections the server can have. A value of-1means unlimited connections.- Parameters:
connections- maximum number of connections allowed on the server- Since:
- 03.05.00
- See Also:
getMaxConnections(HttpExchange)
-
getMaxServerConnections
public final int getMaxServerConnections()
Returns the maximum number of connections the server can have.- Returns:
- maximum number of connections allowed on th server
- Since:
- 03.05.00
- See Also:
setMaxServerConnections(int)
-
-