Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Finkbeiner2016-12-16 11:51:31 -0500
committerAndrew M. Finkbeiner2016-12-17 18:09:49 -0500
commitbbdc3fdc83895b6f6f37ca4e93469116b45f06fc (patch)
tree9757efbc4598df47726c319d439d79d24a34ee76
parent63ce80af31634205e77be8bf44e179681907a457 (diff)
downloadorg.eclipse.osee-ote_0.24.0.tar.gz
org.eclipse.osee-ote_0.24.0.tar.xz
org.eclipse.osee-ote_0.24.0.zip
feature: Cleanup the subscription logicOTE_MOVEote_0.24.0
-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