Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/db/AbstractMessageDataBase.java6
-rw-r--r--plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/MessageServiceSupport.java14
2 files changed, 15 insertions, 5 deletions
diff --git a/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/db/AbstractMessageDataBase.java b/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/db/AbstractMessageDataBase.java
index e71edf5059..c8b8223ccc 100644
--- a/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/db/AbstractMessageDataBase.java
+++ b/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/db/AbstractMessageDataBase.java
@@ -47,6 +47,8 @@ public abstract class AbstractMessageDataBase {
private final ConcurrentHashMap<Integer, MessageInstance> idToMsgMap =
new ConcurrentHashMap<Integer, MessageInstance>();
+ private Executor worker = Executors.newSingleThreadExecutor();
+
private IMsgToolServiceClient client;
private volatile boolean connected = false;
private MessageController messageController;
@@ -277,7 +279,7 @@ public abstract class AbstractMessageDataBase {
}
private boolean doInstanceAttach(MessageInstance instance) throws Exception {
- new Thread(new Runnable() {
+ worker.execute(new Runnable() {
@Override
public void run() {
Integer id;
@@ -290,7 +292,7 @@ public abstract class AbstractMessageDataBase {
e.printStackTrace();
}
}
- }).start();
+ });
return true;
}
diff --git a/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/MessageServiceSupport.java b/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/MessageServiceSupport.java
index 36081202df..66896dedf3 100644
--- a/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/MessageServiceSupport.java
+++ b/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/MessageServiceSupport.java
@@ -53,11 +53,13 @@ public class MessageServiceSupport {
return send;
}
+ /**
+ * @deprecated use {@link #subscribeToMessage(SubscribeToMessage, SubscriptionHandler)}
+ * @param subscribeToMessage
+ * @return
+ */
@Deprecated
public static SubscriptionDetails subscribeToMessage(SubscribeToMessage subscribeToMessage) {
- if(Thread.currentThread().getName().contains("main")){
- System.out.println("bad");
- }
SerializedSubscriptionDetailsMessage resp = new SerializedSubscriptionDetailsMessage();
try{
SerializedSubscribeToMessage cmd = new SerializedSubscribeToMessage(subscribeToMessage);
@@ -74,6 +76,12 @@ public class MessageServiceSupport {
}
}
+ /**
+ * Subscribes to a message and notifies the user in a callback so that we do not block any UI threads.
+ *
+ * @param subscribeToMessage
+ * @param handler
+ */
public static void subscribeToMessage(SubscribeToMessage subscribeToMessage, SubscriptionHandler handler) {
worker.execute(new Runnable(){
@Override

Back to the top