Skip to content
Snippets Groups Projects
Commit b1301aee authored by René Schöne's avatar René Schöne
Browse files

WIP: working on correct connect and disconnect

- fixing imports
parent 729568de
No related branches found
No related tags found
1 merge request!12Ensure correct connect and disconnect functionality
Pipeline #10665 failed
import java.util.Set;
import java.util.TreeSet;
import java.util.LinkedList;
aspect Errors { aspect Errors {
coll Set<ErrorMessage> RagConnect.errors() coll Set<ErrorMessage> RagConnect.errors()
[new TreeSet<ErrorMessage>()] [new TreeSet<ErrorMessage>()]
......
import java.util.*;
aspect Imports {
// empty
}
import java.util.List;
import java.util.ArrayList;
aspect RagConnectNavigation { aspect RagConnectNavigation {
// --- program --- // --- program ---
......
...@@ -239,7 +239,7 @@ public class MqttHandler { ...@@ -239,7 +239,7 @@ public class MqttHandler {
private java.util.List<java.util.function.BiConsumer<String, byte[]>> callbacksFor(String topicString) { private java.util.List<java.util.function.BiConsumer<String, byte[]>> callbacksFor(String topicString) {
java.util.List<java.util.function.BiConsumer<String, byte[]>> result = new java.util.ArrayList<>(); java.util.List<java.util.function.BiConsumer<String, byte[]>> result = new java.util.ArrayList<>();
List<BiConsumer<String, byte[]>> normalCallbackList = normalCallbacks.get(topicString); java.util.List<java.util.function.BiConsumer<String, byte[]>> normalCallbackList = normalCallbacks.get(topicString);
if (normalCallbackList != null) { if (normalCallbackList != null) {
result.addAll(normalCallbackList); result.addAll(normalCallbackList);
} }
...@@ -305,7 +305,7 @@ public class MqttHandler { ...@@ -305,7 +305,7 @@ public class MqttHandler {
if (pairToAddTo == null) { if (pairToAddTo == null) {
pairToAddTo = new PatternCallbackListPair(); pairToAddTo = new PatternCallbackListPair();
pairToAddTo.pattern = java.util.regex.Pattern.compile(regex); pairToAddTo.pattern = java.util.regex.Pattern.compile(regex);
pairToAddTo.callbacks = new ArrayList<>(); pairToAddTo.callbacks = new java.util.ArrayList<>();
wildcardCallbacks.add(pairToAddTo); wildcardCallbacks.add(pairToAddTo);
} }
needSubscribe = pairToAddTo.callbacks.isEmpty(); needSubscribe = pairToAddTo.callbacks.isEmpty();
...@@ -321,7 +321,7 @@ public class MqttHandler { ...@@ -321,7 +321,7 @@ public class MqttHandler {
} }
if (needSubscribe) { if (needSubscribe) {
// subscribe at broker // subscribe at broker
CountDownLatch operationFinished = new CountDownLatch(1); java.util.concurrent.CountDownLatch operationFinished = new java.util.concurrent.CountDownLatch(1);
java.util.concurrent.atomic.AtomicReference<Boolean> success = new java.util.concurrent.atomic.AtomicReference<>(true); java.util.concurrent.atomic.AtomicReference<Boolean> success = new java.util.concurrent.atomic.AtomicReference<>(true);
org.fusesource.mqtt.client.Topic[] topicArray = { new org.fusesource.mqtt.client.Topic(topic, this.qos) }; org.fusesource.mqtt.client.Topic[] topicArray = { new org.fusesource.mqtt.client.Topic(topic, this.qos) };
connection.getDispatchQueue().execute(() -> { connection.getDispatchQueue().execute(() -> {
...@@ -341,7 +341,7 @@ public class MqttHandler { ...@@ -341,7 +341,7 @@ public class MqttHandler {
}); });
}); });
try { try {
operationFinished.await(2, TimeUnit.SECONDS); operationFinished.await(2, java.util.concurrent.TimeUnit.SECONDS);
return success.get(); return success.get();
} catch (InterruptedException e) { } catch (InterruptedException e) {
return false; return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment