Class ServerSessionThrottler

    • 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 handler
        maxConnections - maximum allowed server connections
        Since:
        03.05.00
        See Also:
        HttpSessionHandler
    • Method Detail

      • getMaxConnections

        public int getMaxConnections​(HttpSession session,
                                     HttpExchange exchange)
        Returns the maximum number of connections for a session. A value of -1 means unlimited connections.
        Parameters:
        session - session to process
        exchange - 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 process
        exchange - 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 -1 means 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)