From 8547f6f7d080ea77db116bf3de207f05bef0c2de Mon Sep 17 00:00:00 2001 From: Andrew M Finkbeiner Date: Sun, 22 Apr 2012 14:02:58 -0700 Subject: refinement: Make sure OTE client gets notified of server disconnects --- .../eclipse/osee/ote/service/core/TestClientServiceImpl.java | 5 +++-- .../org/eclipse/osee/ote/service/core/TestHostConnection.java | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'plugins/org.eclipse.osee.ote.client') diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java index fc32a4efbd0..df44c701157 100644 --- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java +++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java @@ -362,10 +362,11 @@ public class TestClientServiceImpl implements IOteClientService, IConnectorListe @Override public synchronized void onConnectorRemoved(IServiceConnector connector) { - testHosts.remove(connector.getUniqueServerId()); + String id = connector.getUniqueServerId(); + testHosts.remove(id); notifyHostUnavailable(connector, new OteServiceProperties(connector)); IHostTestEnvironment connectedHost = getConnectedHost(); - if (connectedHost != null) { + if (testConnection != null && testConnection.getId().equals(id)) { testConnection = null; listenerNotifier.notifyConnectionLost(connector); } diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestHostConnection.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestHostConnection.java index 84dff6afe22..f5948cecb62 100644 --- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestHostConnection.java +++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestHostConnection.java @@ -11,6 +11,7 @@ package org.eclipse.osee.ote.service.core; import java.rmi.RemoteException; + import org.eclipse.osee.connection.service.IServiceConnector; import org.eclipse.osee.ote.core.environment.UserTestSessionKey; import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment; @@ -28,6 +29,7 @@ class TestHostConnection { private final ITestEnvironment connectEnvironment; private final UserTestSessionKey sessionKey; private final IHostTestEnvironment host; + private String serverId; TestHostConnection(IServiceConnector connector, IHostTestEnvironment host, ITestEnvironment connectEnvironment, UserTestSessionKey sessionKey) { // intentionally package-private @@ -44,6 +46,11 @@ class TestHostConnection { this.host = host; this.connectEnvironment = connectEnvironment; this.sessionKey = sessionKey; + try { + this.serverId = (String) host.getProperties().getProperty("id"); + } catch (RemoteException e) { + this.serverId = ""; + } } /** @@ -74,6 +81,10 @@ class TestHostConnection { return serviceConnector; } + public String getId(){ + return serverId; + } + void endConnection() throws RemoteException { // intentionally package-private -- cgit v1.2.3