Class LocalNewSessionQueue

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.openqa.selenium.remote.http.HttpHandler, org.openqa.selenium.remote.http.Routable, HasReadyState

    public class LocalNewSessionQueue
    extends NewSessionQueue
    implements java.io.Closeable
    An in-memory implementation of the list of new session requests.

    The lifecycle of a request can be described as:

    1. User adds an item on to the queue using addToQueue(SessionRequest). This will block until the request completes in some way.
    2. After being added, a NewSessionRequestEvent is fired. Listeners should use this as an indication to call remove(RequestId) to get the session request.
    3. If the session request is completed, then complete(RequestId, Either) must be called. This will not only ensure that addToQueue(SessionRequest) returns, but will also fire a NewSessionRejectedEvent if the session was rejected. Positive completions of events are assumed to be notified on the event bus by other listeners.
    4. If the request cannot be handled right now, call retryAddToQueue(SessionRequest) to return the session request to the front of the queue.

    There is a background thread that will reap SessionRequests that have timed out. This means that a request can either complete by a listener calling complete(RequestId, Either) directly, or by being reaped by the thread.