Class RedisBackedDistributor
java.lang.Object
org.openqa.selenium.grid.distributor.Distributor
org.openqa.selenium.grid.distributor.redis.RedisBackedDistributor
- All Implemented Interfaces:
Closeable, AutoCloseable, Predicate<HttpRequest>, HttpHandler, Routable, HasReadyState
Stateless, horizontally-scalable implementation of
Distributor backed by Redis.
All grid model state (node registry, slot reservations, health counts) is stored in Redis via
RedisBackedNodeRegistry and RedisBackedGridModel. Multiple replicas of this class
can safely run concurrently against the same Redis instance; slot reservation uses atomic
SET NX to prevent double-allocation.
Configure via:
[distributor]
implementation = "org.openqa.selenium.grid.distributor.redis.RedisBackedDistributor"
redis-url = "redis://redis-service:6379"
-
Constructor Summary
ConstructorsConstructorDescriptionRedisBackedDistributor(Tracer tracer, EventBus bus, HttpClient.Factory clientFactory, SessionMap sessions, NewSessionQueue sessionQueue, SlotSelector slotSelector, Secret registrationSecret, Duration healthcheckInterval, boolean rejectUnsupportedCaps, Duration sessionRequestRetryInterval, int newSessionThreadPoolSize, SlotMatcher slotMatcher, Duration purgeNodesInterval, URI redisUri) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static Distributorbooleanintprotected Set<NodeStatus> longintprotected @Nullable NodegetNodeFromURI(URI uri) longbooleanisReady()newSession(SessionRequest request) voidrefresh()voidMethods inherited from class Distributor
execute, matches, test
-
Constructor Details
-
RedisBackedDistributor
public RedisBackedDistributor(Tracer tracer, EventBus bus, HttpClient.Factory clientFactory, SessionMap sessions, NewSessionQueue sessionQueue, SlotSelector slotSelector, Secret registrationSecret, Duration healthcheckInterval, boolean rejectUnsupportedCaps, Duration sessionRequestRetryInterval, int newSessionThreadPoolSize, SlotMatcher slotMatcher, Duration purgeNodesInterval, URI redisUri)
-
-
Method Details
-
create
-
isReady
public boolean isReady()- Specified by:
isReadyin interfaceHasReadyState
-
add
- Specified by:
addin classDistributor
-
drain
- Specified by:
drainin classDistributor
-
remove
- Specified by:
removein classDistributor
-
getStatus
- Specified by:
getStatusin classDistributor
-
refresh
-
getAvailableNodes
-
newSession
public Either<SessionNotCreatedException, CreateSessionResponse> newSession(SessionRequest request) throws SessionNotCreatedException - Specified by:
newSessionin classDistributor- Throws:
SessionNotCreatedException
-
getUpNodeCount
public long getUpNodeCount() -
getDownNodeCount
public long getDownNodeCount() -
getActiveSlots
public int getActiveSlots() -
getIdleSlots
public int getIdleSlots() -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getNodeFromURI
-