Skip to content
Snippets Groups Projects
Commit 176e8b79 authored by Jonas Arnhold's avatar Jonas Arnhold
Browse files

use !Thread.currentThread().isInterrupted()

parent 60651354
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,7 @@ public class MessageSender implements Runnable {
@Override
public void run() {
while (true) {
while (!Thread.currentThread().isInterrupted()) {
if (!deadLetterBuffer.isEmpty()) {
deadLetterBuffer.stream().filter(this::trySendToCloud).forEach(deadLetterBuffer::remove);
......
......@@ -29,7 +29,7 @@ public class SensorDataCollector implements Runnable {
temperatureSub.connect("tcp://*:%s".formatted(TEMPERATURE_TOPIC_PORT));
temperatureSub.subscribe(TEMPERATURE_TOPIC.getBytes());
while (true) {
while (!Thread.currentThread().isInterrupted()) {
String usageData = usageSub.recvStr().substring(USAGE_TOPIC.length() + 1);
String temperatureData = temperatureSub.recvStr().substring(TEMPERATURE_TOPIC.length() + 1);
messagebuffer.offer(new SensorData(usageData, temperatureData));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment