Class ServerSessionThrottler
- java.lang.Object
-
- com.kttdevelopment.simplehttpserver.handler.ServerSessionThrottler
-
public class ServerSessionThrottler extends Object
Limits connections per session to the server and total server sessions.- Since:
- 03.05.00
- Version:
- 03.05.01
- Author:
- Ktt Development
- See Also:
HttpSession,HttpSessionHandler,ThrottledHandler,ExchangeThrottler,ServerExchangeThrottler,SessionThrottler
-
-
Constructor Summary
Constructors Constructor Description ServerSessionThrottler(HttpSessionHandler sessionHandler)Creates a throttler with limits on session and total connections.ServerSessionThrottler(HttpSessionHandler sessionHandler, int maxConnections)Creates a throttler with limits on session and total connections.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanIgnoreConnectionLimit(HttpSession session, HttpExchange exchange)Returns if a session is exempt from the server connection limit only.intgetMaxConnections(HttpSession session, HttpExchange exchange)Returns the maximum number of connections for a session.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
-
ServerSessionThrottler
public ServerSessionThrottler(HttpSessionHandler sessionHandler)
Creates a throttler with limits on session and total connections.- Parameters:
sessionHandler- http session handler- Since:
- 03.05.00
- See Also:
HttpSessionHandler
-
ServerSessionThrottler
public ServerSessionThrottler(HttpSessionHandler sessionHandler, int maxConnections)
Creates a throttler with limits on session and total connections.- Parameters:
sessionHandler- http session handlermaxConnections- maximum allowed server connections- Since:
- 03.05.00
- See Also:
HttpSessionHandler
-
-
Method Detail
-
getMaxConnections
public final 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)
-
getMaxConnections
public int getMaxConnections(HttpSession session, HttpExchange exchange)
Returns the maximum number of connections for a session. A value of-1means unlimited connections.- Parameters:
session- session to processexchange- exchange to process- Returns:
- maximum number of connections allowed
- Since:
- 03.05.00
-
canIgnoreConnectionLimit
public boolean canIgnoreConnectionLimit(HttpSession session, HttpExchange exchange)
Returns if a session is exempt from the server connection limit only.- Parameters:
session- session to processexchange- exchange to process- Returns:
- if exchange ignores server connection limit
- Since:
- 03.05.00
- See Also:
HttpSession,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)
-
-