Skip to content

Commit

Permalink
Adding some docs for the LocalNewSessionQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Apr 26, 2021
1 parent 554873d commit 7fd49ca
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,29 @@
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
import static java.util.concurrent.TimeUnit.MILLISECONDS;

/**
* An in-memory implementation of the list of new session requests.
* <p>
* The lifecycle of a request can be described as:
* <ol>
* <li>User adds an item on to the queue using {@link #addToQueue(SessionRequest)}. This
* will block until the request completes in some way.
* <li>After being added, a {@link NewSessionRequestEvent} is fired. Listeners should use
* this as an indication to call {@link #remove(RequestId)} to get the session request.
* <li>If the session request is completed, then {@link #complete(RequestId, Either)} must
* be called. This will not only ensure that {@link #addToQueue(SessionRequest)}
* returns, but will also fire a {@link NewSessionRejectedEvent} if the session was
* rejected. Positive completions of events are assumed to be notified on the event bus
* by other listeners.
* <li>If the request cannot be handled right now, call
* {@link #retryAddToQueue(SessionRequest)} to return the session request to the front
* of the queue.
* </ol>
* <p>
* There is a background thread that will reap {@link SessionRequest}s that have timed out.
* This means that a request can either complete by a listener calling
* {@link #complete(RequestId, Either)} directly, or by being reaped by the thread.
*/
@ManagedService(objectName = "org.seleniumhq.grid:type=SessionQueue,name=LocalSessionQueue",
description = "New session queue")
public class LocalNewSessionQueue extends NewSessionQueue implements Closeable {
Expand Down Expand Up @@ -214,7 +237,6 @@ public boolean retryAddToQueue(SessionRequest request) {
Require.nonNull("New session request", request);

boolean added;
Data data;

Lock writeLock = lock.writeLock();
writeLock.lock();
Expand Down

0 comments on commit 7fd49ca

Please sign in to comment.