From 5bc8952c3bf10e0f78130261239f086987a16c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sautter?= Date: Sun, 3 Mar 2024 19:36:18 +0100 Subject: [PATCH] [java] improve memory allocation of an idle relay node #13643 --- .../org/openqa/selenium/grid/node/relay/RelayOptions.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/java/src/org/openqa/selenium/grid/node/relay/RelayOptions.java b/java/src/org/openqa/selenium/grid/node/relay/RelayOptions.java index 6aebcb19db783..9325942aeb90e 100644 --- a/java/src/org/openqa/selenium/grid/node/relay/RelayOptions.java +++ b/java/src/org/openqa/selenium/grid/node/relay/RelayOptions.java @@ -32,6 +32,7 @@ import java.util.Optional; import java.util.logging.Logger; import org.openqa.selenium.Capabilities; +import org.openqa.selenium.ImmutableCapabilities; import org.openqa.selenium.grid.config.Config; import org.openqa.selenium.grid.config.ConfigException; import org.openqa.selenium.grid.node.SessionFactory; @@ -149,18 +150,19 @@ public Map> getSessionFactories( LOG.info(String.format("Adding relay configs for %s", getServiceUri())); parsedConfigs.forEach( (maxSessions, stereotype) -> { + ImmutableCapabilities immutable = new ImmutableCapabilities(stereotype); for (int i = 0; i < maxSessions; i++) { factories.put( - stereotype, + immutable, new RelaySessionFactory( tracer, clientFactory, sessionTimeout, getServiceUri(), getServiceStatusUri(), - stereotype)); + immutable)); } - LOG.info(String.format("Mapping %s, %d times", stereotype, maxSessions)); + LOG.info(String.format("Mapping %s, %d times", immutable, maxSessions)); }); return factories.build().asMap(); }