Class RedisBackedNewSessionQueue

java.lang.Object
org.openqa.selenium.grid.sessionqueue.NewSessionQueue
org.openqa.selenium.grid.sessionqueue.redis.RedisBackedNewSessionQueue
All Implemented Interfaces:
Closeable, AutoCloseable, HttpHandler, Routable, HasReadyState

public class RedisBackedNewSessionQueue extends NewSessionQueue implements Closeable
Stateless, horizontally-scalable implementation of NewSessionQueue backed by Redis.

All queue state — request order, request payloads, per-request deadlines and the completion result — lives in Redis. This lets several SessionQueue replicas share a single logical queue: the Distributor (or several Distributor replicas) can poll and complete requests against any replica.

The HTTP thread that calls addToQueue(SessionRequest) blocks until the request is completed. Because the completing complete() call may arrive at a different replica than the one holding the blocked thread, completion is signalled two ways: a JVM-local CountDownLatch fast-path for same-replica completion, and polling of the Redis result key as the cross-replica fallback. Atomic SET NX on a per-request completion marker ensures a single winner when a timeout races a successful creation.

Configure via:

[sessionqueue]
implementation = "org.openqa.selenium.grid.sessionqueue.redis.RedisBackedNewSessionQueue"
backend-url = "redis://redis-service:6379"