Skip to content

Commit f8db293

Browse files
committed
Merge pull request #204 from jpwsutton/develop
Resolving Issue #202 - Workaround for deadlock in CommsSender.stop
2 parents c5d43ff + f0eae3a commit f8db293

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal

org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal/CommsSender.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ public void stop() {
7575
running = false;
7676
if (!Thread.currentThread().equals(sendThread)) {
7777
try {
78-
// first notify get routine to finish
79-
clientState.notifyQueueLock();
80-
// Wait for the thread to finish.
81-
sendThread.join();
78+
while(sendThread.isAlive()){
79+
// first notify get routine to finish
80+
clientState.notifyQueueLock();
81+
// Wait for the thread to finish.
82+
sendThread.join(100);
83+
}
8284
}
8385
catch (InterruptedException ex) {
8486
}

0 commit comments

Comments
 (0)