Skip to content

Commit 262f628

Browse files
committed
server: Reusing existing constants
1 parent 5023dfe commit 262f628

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Diff for: java/server/src/org/openqa/grid/internal/utils/SelfRegisteringRemote.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package org.openqa.grid.internal.utils;
1919

2020
import static org.openqa.grid.common.RegistrationRequest.AUTO_REGISTER;
21+
import static org.openqa.grid.internal.utils.ServerJsonValues.BROWSER_TIMEOUT;
22+
import static org.openqa.grid.internal.utils.ServerJsonValues.CLIENT_TIMEOUT;
2123

2224
import com.google.gson.JsonArray;
2325
import com.google.gson.JsonObject;
@@ -53,7 +55,6 @@
5355
import java.util.Arrays;
5456
import java.util.List;
5557
import java.util.Map;
56-
import java.util.logging.Level;
5758
import java.util.logging.Logger;
5859

5960
import javax.servlet.Servlet;
@@ -94,18 +95,16 @@ public void startRemoteServer() throws Exception {
9495
RemoteControlConfiguration remoteControlConfiguration = nodeConfig.getRemoteControlConfiguration();
9596

9697
try {
97-
final String CLIENT_TIMEOUT = "timeout";
98-
final String BROWSER_TIMEOUT = "browserTimeout";
9998
JsonObject hubParameters = getHubConfiguration();
100-
if (hubParameters.has(CLIENT_TIMEOUT)){
101-
int timeout = hubParameters.get(CLIENT_TIMEOUT).getAsInt() / 1000;
99+
if (hubParameters.has(CLIENT_TIMEOUT.getKey())){
100+
int timeout = hubParameters.get(CLIENT_TIMEOUT.getKey()).getAsInt() / 1000;
102101
remoteControlConfiguration.setTimeoutInSeconds(timeout);
103102
}
104-
if (hubParameters.has(BROWSER_TIMEOUT)) {
105-
int browserTimeout = hubParameters.get(BROWSER_TIMEOUT).getAsInt();
103+
if (hubParameters.has(BROWSER_TIMEOUT.getKey())) {
104+
int browserTimeout = hubParameters.get(BROWSER_TIMEOUT.getKey()).getAsInt();
106105
remoteControlConfiguration.setBrowserTimeoutInMs(browserTimeout);
107106
}
108-
}catch (Exception e) {
107+
} catch (Exception e) {
109108
LOG.warning(
110109
"error getting the parameters from the hub. The node may end up with wrong timeouts." + e
111110
.getMessage());

0 commit comments

Comments
 (0)