Class Distributor

  • All Implemented Interfaces:
    java.util.function.Predicate<org.openqa.selenium.remote.http.HttpRequest>, org.openqa.selenium.remote.http.HttpHandler, org.openqa.selenium.remote.http.Routable, HasReadyState
    Direct Known Subclasses:
    LocalDistributor, RemoteDistributor

    public abstract class Distributor
    extends java.lang.Object
    implements HasReadyState, java.util.function.Predicate<org.openqa.selenium.remote.http.HttpRequest>, org.openqa.selenium.remote.http.Routable
    Responsible for being the central place where the Nodes on which Sessions 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 for Node for how the Node should be serialized.
    DELETE /se/grid/distributor/node/{nodeId} Remove the Node identified by nodeId 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.openqa.selenium.remote.tracing.Tracer tracer  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Distributor​(org.openqa.selenium.remote.tracing.Tracer tracer, org.openqa.selenium.remote.http.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)  
      org.openqa.selenium.remote.http.HttpResponse execute​(org.openqa.selenium.remote.http.HttpRequest req)  
      abstract DistributorStatus getStatus()  
      boolean matches​(org.openqa.selenium.remote.http.HttpRequest req)  
      abstract org.openqa.selenium.internal.Either<org.openqa.selenium.SessionNotCreatedException,​CreateSessionResponse> newSession​(SessionRequest request)  
      abstract void remove​(NodeId nodeId)  
      boolean test​(org.openqa.selenium.remote.http.HttpRequest httpRequest)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Predicate

        and, negate, or
      • Methods inherited from interface org.openqa.selenium.remote.http.Routable

        with
    • Field Detail

      • tracer

        protected final org.openqa.selenium.remote.tracing.Tracer tracer
    • Constructor Detail

      • Distributor

        protected Distributor​(org.openqa.selenium.remote.tracing.Tracer tracer,
                              org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
                              Secret registrationSecret)
    • Method Detail

      • newSession

        public abstract org.openqa.selenium.internal.Either<org.openqa.selenium.SessionNotCreatedException,​CreateSessionResponse> newSession​(SessionRequest request)
                                                                                                                                            throws org.openqa.selenium.SessionNotCreatedException
        Throws:
        org.openqa.selenium.SessionNotCreatedException
      • drain

        public abstract boolean drain​(NodeId nodeId)
      • remove

        public abstract void remove​(NodeId nodeId)
      • test

        public boolean test​(org.openqa.selenium.remote.http.HttpRequest httpRequest)
        Specified by:
        test in interface java.util.function.Predicate<org.openqa.selenium.remote.http.HttpRequest>
      • matches

        public boolean matches​(org.openqa.selenium.remote.http.HttpRequest req)
        Specified by:
        matches in interface org.openqa.selenium.remote.http.Routable
      • execute

        public org.openqa.selenium.remote.http.HttpResponse execute​(org.openqa.selenium.remote.http.HttpRequest req)
                                                             throws java.io.UncheckedIOException
        Specified by:
        execute in interface org.openqa.selenium.remote.http.HttpHandler
        Throws:
        java.io.UncheckedIOException