diff options
author | Mike Masterson | 2011-09-30 22:21:44 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2011-09-30 22:21:44 +0000 |
commit | a5046adc5fe733278b77d69211d3353334527ec6 (patch) | |
tree | 3d8eae589f8065a83712b26b0cda8b47ca22e996 /plugins/org.eclipse.osee.ote.client | |
parent | 7c7d0da3a9267513e48b64263ed899a30add2fd5 (diff) | |
download | org.eclipse.osee-a5046adc5fe733278b77d69211d3353334527ec6.tar.gz org.eclipse.osee-a5046adc5fe733278b77d69211d3353334527ec6.tar.xz org.eclipse.osee-a5046adc5fe733278b77d69211d3353334527ec6.zip |
feature: Servers showing up without a broker
Hosts were being provided without a broker URI being set.
This fix prevents those hosts from being used until their
broker property is set correctly.
Diffstat (limited to 'plugins/org.eclipse.osee.ote.client')
2 files changed, 19 insertions, 10 deletions
diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnector.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnector.java index ae6145eacc5..ec5b9c2469e 100644 --- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnector.java +++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnector.java @@ -20,10 +20,12 @@ import java.rmi.server.ExportException; import java.util.HashMap; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; + import net.jini.export.Exporter; import net.jini.jeri.BasicILFactory; import net.jini.jeri.BasicJeriExporter; import net.jini.jeri.tcp.TcpServerEndpoint; + import org.eclipse.osee.connection.service.IServiceConnector; import org.eclipse.osee.connection.service.IServicePropertyChangeListener; import org.eclipse.osee.framework.jdk.core.util.EnhancedProperties; diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/OteJmsServiceConnector.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/OteJmsServiceConnector.java index 553001f5042..52ce3dba074 100644 --- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/OteJmsServiceConnector.java +++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/OteJmsServiceConnector.java @@ -18,8 +18,8 @@ import java.net.URISyntaxException; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; + import org.eclipse.osee.connection.service.IConnectionService; -import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.messaging.ConnectionNode; import org.eclipse.osee.framework.messaging.MessageService; @@ -40,6 +40,10 @@ import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment; */ class OteJmsServiceConnector implements ServiceNotification, OseeMessagingStatusCallback { + /** + * + */ + private static final String OTE_EMBEDDED_BROKER_PROP = "OTEEmbeddedBroker"; private final ConcurrentHashMap<String, JmsToJiniBridgeConnector> connectors; private final ConcurrentHashMap<String, ServiceHealth> serviceHealthMap; private final RemoteServiceLookup remoteServiceLookup; @@ -116,16 +120,13 @@ class OteJmsServiceConnector implements ServiceNotification, OseeMessagingStatus private void requestJmsJiniBridgeConnector(ServiceHealth serviceHealth) { try { - // ConnectionNode connectionNode = messageService.get(new NodeInfo(serviceHealth.getServiceUniqueId(), new URI(serviceHealth.getBrokerURI()))); +// ConnectionNode connectionNode = messageService.get(new NodeInfo(serviceHealth.getServiceUniqueId(), new URI(serviceHealth.getBrokerURI()))); ConnectionNode connectionNode = messageService.getDefault(); connectionNode.subscribeToReply(OteBaseMessages.RequestOteHost, myOteServiceRequestHandler); connectionNode.send(OteBaseMessages.RequestOteHost, serviceHealth.getServiceUniqueId(), this); - } catch (OseeCoreException ex) { + } catch (Exception ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } - // catch (URISyntaxException ex) { - // OseeLog.log(Activator.class, Level.SEVERE, ex); - // } } private boolean isNewService(ServiceHealth serviceHealth) { @@ -147,17 +148,18 @@ class OteJmsServiceConnector implements ServiceNotification, OseeMessagingStatus public void process(Object message, Map<String, Object> headers, ReplyConnection replyConnection) { try { - // System.out.println("please be a remote reference"); ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) message); ObjectInputStream ois = new ObjectInputStream(bais); Object msg = ois.readObject(); msg.toString(); Object obj = ois.readObject(); IHostTestEnvironment hostEnv = (IHostTestEnvironment) obj; + String id = hostEnv.getProperties().getProperty("id").toString(); - if (id != null && connectors.get(id) == null) { + NodeInfo nodeInfo = getNodeInfo(id); + if (nodeInfo != null && !connectors.containsKey(id)) { JmsToJiniBridgeConnector connector = new JmsToJiniBridgeConnector(exportClassLoader, hostEnv, id); - connector.setProperty("OTEEmbeddedBroker", getNodeInfo(id)); + connector.setProperty(OTE_EMBEDDED_BROKER_PROP, nodeInfo); connectors.put(id, connector); connectionService.addConnector(connector); } @@ -167,16 +169,21 @@ class OteJmsServiceConnector implements ServiceNotification, OseeMessagingStatus OseeLog.log(Activator.class, Level.SEVERE, ex); } catch (URISyntaxException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); } } + } private NodeInfo getNodeInfo(String id) throws URISyntaxException { ServiceHealth serviceHealth = this.serviceHealthMap.get(id); + if (serviceHealth != null) { - return new NodeInfo("OTEEmbeddedBroker", new URI(serviceHealth.getBrokerURI())); + return new NodeInfo(OTE_EMBEDDED_BROKER_PROP, new URI(serviceHealth.getBrokerURI())); } return null; } + } |