Skip to content

Commit

Permalink
KristianRosenvold: Fixed more string/int issues and problem with time…
Browse files Browse the repository at this point in the history
…out s/ms

This seems related to the GHC change, will need to determine why we get strings

r16456
  • Loading branch information
krosenvold committed Apr 4, 2012
1 parent b456bec commit 1b2e416
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions java/server/src/org/openqa/grid/internal/BaseRemoteProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ public BaseRemoteProxy(RegistrationRequest request, Registry registry) {
this.id = remoteHost.toExternalForm();
}

maxConcurrentSession = (Integer) this.config.get(RegistrationRequest.MAX_SESSION);
cleanUpCycle = (Integer) this.config.get(RegistrationRequest.CLEAN_UP_CYCLE);
timeOut = (Integer) this.config.get(RegistrationRequest.TIME_OUT);
maxConcurrentSession = (Integer) getConfigInteger(RegistrationRequest.MAX_SESSION);
cleanUpCycle = getConfigInteger(RegistrationRequest.CLEAN_UP_CYCLE);
timeOut = getConfigInteger(RegistrationRequest.TIME_OUT);

List<DesiredCapabilities> capabilities = request.getCapabilities();

Expand Down Expand Up @@ -161,6 +161,14 @@ public BaseRemoteProxy(RegistrationRequest request, Registry registry) {
this.testSlots = Collections.unmodifiableList(slots);
}

private Integer getConfigInteger(String key){
Object o = this.config.get(RegistrationRequest.TIME_OUT);
if (o instanceof String){
return Integer.parseInt((String)o);
}
return (Integer) o;
}

private SeleniumProtocol getProtocol(DesiredCapabilities capability) {
String type = (String) capability.getCapability(SELENIUM_PROTOCOL);

Expand Down Expand Up @@ -281,7 +289,7 @@ private void cleanUpSlot(TestSlot slot) {
TestSession session = slot.getSession();
if (session != null) {
long inactivity = session.getInactivityTime();
boolean hasTimedOut = inactivity > timeOut;
boolean hasTimedOut = inactivity > timeOut*1000;
if (hasTimedOut) {
if (!session.isForwardingRequest()) {
log.logp(Level.WARNING, "SessionCleanup", null,
Expand Down

0 comments on commit 1b2e416

Please sign in to comment.