Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorafinkbein2010-02-22 22:20:00 +0000
committerafinkbein2010-02-22 22:20:00 +0000
commit00dabd59c3cbfcc12dc6c92d5d2dce86d6dd0442 (patch)
tree19f7be289d7647366deb5b295c67e643c06d374f
parent3c154fae8d34f913f39d0bea8382ba0e727a7f56 (diff)
downloadorg.eclipse.osee-00dabd59c3cbfcc12dc6c92d5d2dce86d6dd0442.tar.gz
org.eclipse.osee-00dabd59c3cbfcc12dc6c92d5d2dce86d6dd0442.tar.xz
org.eclipse.osee-00dabd59c3cbfcc12dc6c92d5d2dce86d6dd0442.zip
-rw-r--r--org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/NodeInfo.java2
-rw-r--r--org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeActiveMq.java22
-rw-r--r--org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/MonitorTimedOutServices.java14
3 files changed, 18 insertions, 20 deletions
diff --git a/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/NodeInfo.java b/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/NodeInfo.java
index 200e345feda..8e1a8ebae23 100644
--- a/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/NodeInfo.java
+++ b/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/NodeInfo.java
@@ -41,7 +41,7 @@ public class NodeInfo {
}
public boolean isVMComponent() {
- return getComponentName().equals(Component.VM);
+ return getComponentName().equals(Component.VM.getComponentName());
}
/*
diff --git a/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeActiveMq.java b/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeActiveMq.java
index 37fbc698dff..10915359d1f 100644
--- a/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeActiveMq.java
+++ b/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/internal/activemq/ConnectionNodeActiveMq.java
@@ -37,10 +37,10 @@ import org.eclipse.osee.framework.messaging.OseeMessagingStatusCallback;
*/
class ConnectionNodeActiveMq implements ConnectionNodeFailoverSupport, MessageListener {
- private String version;
- private String sourceId;
+// private String version;
+// private String sourceId;
private NodeInfo nodeInfo;
- private ExecutorService executor;
+// private ExecutorService executor;
private Connection connection;
private Session session;
private TemporaryTopic temporaryTopic;
@@ -53,10 +53,10 @@ class ConnectionNodeActiveMq implements ConnectionNodeFailoverSupport, MessageLi
private ActiveMqUtil activeMqUtil;
public ConnectionNodeActiveMq(String version, String sourceId, NodeInfo nodeInfo, ExecutorService executor) throws JMSException {
- this.version = version;
- this.sourceId = sourceId;
+// this.version = version;
+// this.sourceId = sourceId;
this.nodeInfo = nodeInfo;
- this.executor = executor;
+// this.executor = executor;
activeMqUtil = new ActiveMqUtil();
regularListeners = new ConcurrentHashMap<String, ActiveMqMessageListenerWrapper>();
replyListeners = new ConcurrentHashMap<String, OseeMessagingListener>();
@@ -82,7 +82,7 @@ class ConnectionNodeActiveMq implements ConnectionNodeFailoverSupport, MessageLi
}
@Override
- public void send(MessageID topic, Object body, OseeMessagingStatusCallback statusCallback) throws OseeCoreException {
+ public synchronized void send(MessageID topic, Object body, OseeMessagingStatusCallback statusCallback) throws OseeCoreException {
try {
if (topic.isTopic()) {
Topic destination = session.createTopic(topic.getGuid());
@@ -105,7 +105,7 @@ class ConnectionNodeActiveMq implements ConnectionNodeFailoverSupport, MessageLi
}
@Override
- public void subscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) {
+ public synchronized void subscribe(MessageID messageId, OseeMessagingListener listener, OseeMessagingStatusCallback statusCallback) {
Topic destination;
try {
if (isConnectedThrow()) {
@@ -153,7 +153,7 @@ class ConnectionNodeActiveMq implements ConnectionNodeFailoverSupport, MessageLi
if (correlationId != null) {
OseeMessagingListener listener = replyListeners.get(correlationId);
if (listener != null) {
- listener.process(activeMqUtil.translateMessage(jmsMessage, listener.getClazz()), new HashMap(), new ReplyConnectionActiveMqImpl());
+ listener.process(activeMqUtil.translateMessage(jmsMessage, listener.getClazz()), new HashMap<String, Object>(), new ReplyConnectionActiveMqImpl());
}
}
} catch (JMSException ex) {
@@ -182,7 +182,7 @@ class ConnectionNodeActiveMq implements ConnectionNodeFailoverSupport, MessageLi
}
@Override
- public boolean isConnected() {
+ public synchronized boolean isConnected() {
try {
return isConnectedThrow();
} catch (JMSException ex) {
@@ -191,7 +191,7 @@ class ConnectionNodeActiveMq implements ConnectionNodeFailoverSupport, MessageLi
}
}
- private boolean isConnectedThrow() throws JMSException {
+ private synchronized boolean isConnectedThrow() throws JMSException {
if (connection == null || started == false) {
return false;
}
diff --git a/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/MonitorTimedOutServices.java b/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/MonitorTimedOutServices.java
index 5564e73142d..db219eb0ec6 100644
--- a/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/MonitorTimedOutServices.java
+++ b/org.eclipse.osee.framework.messaging/src/org/eclipse/osee/framework/messaging/services/internal/MonitorTimedOutServices.java
@@ -9,7 +9,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
+import java.util.Map.Entry;
import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap;
import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.messaging.services.ServiceNotification;
@@ -36,14 +36,12 @@ class MonitorTimedOutServices implements Runnable {
Set<Pair<String, String>> keySet = map.keySet();
for(Pair<String, String> pair:keySet){
Map<String, ServiceHealthPlusTimeout> items = map.get(pair.getFirst(), pair.getSecond());
- for(String key:items.keySet()){
- ServiceHealthPlusTimeout serviceHealthPlusTimeout = items.get(key);
- if(serviceHealthPlusTimeout.isTimedOut(currentSystemTime)){
- System.out.println(pair.getFirst() + pair.getSecond() + key);
- toRemove.add(new ThreeItems(pair.getFirst(), pair.getSecond(), key));
+ for(Entry<String, ServiceHealthPlusTimeout> key:items.entrySet()){
+ if(key.getValue().isTimedOut(currentSystemTime)){
+ toRemove.add(new ThreeItems(pair.getFirst(), pair.getSecond(), key.getKey()));
List<ServiceNotification> list = callbacks.get(pair.getFirst(), pair.getSecond());
for(ServiceNotification notify:list){
- notify.onServiceGone(serviceHealthPlusTimeout.getServiceHealth());
+ notify.onServiceGone(key.getValue().getServiceHealth());
}
}
}
@@ -59,7 +57,7 @@ class MonitorTimedOutServices implements Runnable {
}
}
- private class ThreeItems {
+ private static class ThreeItems {
String first;
String second;

Back to the top