Class Distributor
- java.lang.Object
-
- org.openqa.selenium.grid.distributor.Distributor
-
- All Implemented Interfaces:
java.util.function.Predicate<HttpRequest>
,HttpHandler
,Routable
,HasReadyState
- Direct Known Subclasses:
LocalDistributor
,RemoteDistributor
public abstract class Distributor extends java.lang.Object implements HasReadyState, java.util.function.Predicate<HttpRequest>, Routable
Responsible for being the central place where theNode
s on whichSession
s run are determined.This class responds to the following URLs:
Verb URL Template Meaning POST /session This is exactly the same as the New Session command from the WebDriver spec. POST /se/grid/distributor/node Adds a new Node
to this distributor. Please read the javadocs forNode
for how the Node should be serialized.DELETE /se/grid/distributor/node/{nodeId} Remove the Node
identified bynodeId
from this distributor. It is expected that any sessions running on the Node are allowed to complete: this simply means that no new sessions will be scheduled on this Node.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Distributor(Tracer tracer, HttpClient.Factory httpClientFactory, Secret registrationSecret)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Distributor
add(Node node)
abstract boolean
drain(NodeId nodeId)
HttpResponse
execute(HttpRequest req)
abstract DistributorStatus
getStatus()
boolean
matches(HttpRequest req)
abstract Either<SessionNotCreatedException,CreateSessionResponse>
newSession(SessionRequest request)
abstract void
remove(NodeId nodeId)
boolean
test(HttpRequest httpRequest)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openqa.selenium.status.HasReadyState
isReady
-
-
-
-
Field Detail
-
tracer
protected final Tracer tracer
-
-
Constructor Detail
-
Distributor
protected Distributor(Tracer tracer, HttpClient.Factory httpClientFactory, Secret registrationSecret)
-
-
Method Detail
-
newSession
public abstract Either<SessionNotCreatedException,CreateSessionResponse> newSession(SessionRequest request) throws SessionNotCreatedException
- Throws:
SessionNotCreatedException
-
add
public abstract Distributor add(Node node)
-
drain
public abstract boolean drain(NodeId nodeId)
-
remove
public abstract void remove(NodeId nodeId)
-
getStatus
public abstract DistributorStatus getStatus()
-
test
public boolean test(HttpRequest httpRequest)
- Specified by:
test
in interfacejava.util.function.Predicate<HttpRequest>
-
matches
public boolean matches(HttpRequest req)
-
execute
public HttpResponse execute(HttpRequest req) throws java.io.UncheckedIOException
- Specified by:
execute
in interfaceHttpHandler
- Throws:
java.io.UncheckedIOException
-
-