diff --git a/java/server/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java b/java/server/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java index 46f454b5d8b2f..87cc653922476 100644 --- a/java/server/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java +++ b/java/server/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java @@ -4,6 +4,7 @@ import org.openqa.selenium.Capabilities; import org.openqa.selenium.SessionNotCreatedException; import org.openqa.selenium.events.EventBus; +import org.openqa.selenium.grid.config.Config; import org.openqa.selenium.grid.data.CreateSessionResponse; import org.openqa.selenium.grid.data.NewSessionErrorResponse; import org.openqa.selenium.grid.data.NewSessionRejectedEvent; @@ -12,9 +13,14 @@ import org.openqa.selenium.grid.jmx.JMXHelper; import org.openqa.selenium.grid.jmx.ManagedAttribute; import org.openqa.selenium.grid.jmx.ManagedService; +import org.openqa.selenium.grid.log.LoggingOptions; import org.openqa.selenium.grid.security.Secret; +import org.openqa.selenium.grid.security.SecretOptions; +import org.openqa.selenium.grid.server.EventBusOptions; import org.openqa.selenium.grid.sessionqueue.NewSessionQueue; import org.openqa.selenium.grid.sessionqueue.SessionRequest; +import org.openqa.selenium.grid.sessionqueue.config.NewSessionQueueOptions; +import org.openqa.selenium.grid.sessionqueue.config.SessionRequestOptions; import org.openqa.selenium.internal.Either; import org.openqa.selenium.internal.Require; import org.openqa.selenium.remote.http.Contents; @@ -113,6 +119,22 @@ public LocalNewSessionQueue( new JMXHelper().register(this); } + public static NewSessionQueue create(Config config) { + LoggingOptions loggingOptions = new LoggingOptions(config); + Tracer tracer = loggingOptions.getTracer(); + + EventBusOptions eventBusOptions = new EventBusOptions(config); + SessionRequestOptions requestOptions = new SessionRequestOptions(config); + SecretOptions secretOptions = new SecretOptions(config); + + return new LocalNewSessionQueue( + tracer, + eventBusOptions.getEventBus(), + requestOptions.getSessionRequestRetryInterval(), + requestOptions.getSessionRequestTimeout(), + secretOptions.getRegistrationSecret()); + } + private void timeoutSessions() { Instant now = Instant.now();