Skip to content

Commit

Permalink
[grid]: Use the combined client handler in the new Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Feb 18, 2019
1 parent 169f6ff commit 9e76b0c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions java/server/src/org/openqa/selenium/grid/commands/Hub.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
import org.openqa.selenium.grid.server.W3CCommandHandler;
import org.openqa.selenium.grid.sessionmap.SessionMap;
import org.openqa.selenium.grid.sessionmap.local.LocalSessionMap;
import org.openqa.selenium.grid.web.CombinedHandler;
import org.openqa.selenium.grid.web.RoutableHttpClientFactory;
import org.openqa.selenium.grid.web.Routes;
import org.openqa.selenium.remote.http.HttpClient;
import org.openqa.selenium.remote.tracing.DistributedTracer;
Expand Down Expand Up @@ -108,19 +110,28 @@ public Executable configure(String... args) {
EventBusConfig events = new EventBusConfig(config);
EventBus bus = events.getEventBus();

CombinedHandler handler = new CombinedHandler();

SessionMap sessions = new LocalSessionMap(tracer, bus);
handler.addHandler(sessions);

BaseServerOptions serverOptions = new BaseServerOptions(config);

HttpClient.Factory clientFactory = HttpClient.Factory.createDefault();
HttpClient.Factory clientFactory = new RoutableHttpClientFactory(
serverOptions.getExternalUri().toURL(),
handler,
HttpClient.Factory.createDefault());

Distributor distributor = new LocalDistributor(
tracer,
bus,
clientFactory,
sessions);
handler.addHandler(distributor);
Router router = new Router(tracer, clientFactory, sessions, distributor);

Server<?> server = new BaseServer<>(
new BaseServerOptions(config));
serverOptions);
server.addRoute(Routes.matching(router).using(router).decorateWith(W3CCommandHandler.class));
server.start();
};
Expand Down

0 comments on commit 9e76b0c

Please sign in to comment.