Skip to content

Commit

Permalink
Fix #623 issue about observation reset by starting only one cleaningTask
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Dec 3, 2018
1 parent 3a565f8 commit 18f0888
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,16 @@ public void onSendError(Throwable error) {

private synchronized void scheduleCleaningTask() {
if (!cancelled)
cleaningTask = getExecutor().schedule(new Runnable() {
@Override
public void run() {
responseTimedOut.set(true);
coapRequest.cancel();
}
}, timeoutInMs, TimeUnit.MILLISECONDS);
if (cleaningTask == null) {
LOG.trace("Schedule Cleaning Task for {}", coapRequest);
cleaningTask = getExecutor().schedule(new Runnable() {
@Override
public void run() {
responseTimedOut.set(true);
coapRequest.cancel();
}
}, timeoutInMs, TimeUnit.MILLISECONDS);
}
}

private synchronized void cancelCleaningTask() {
Expand Down

0 comments on commit 18f0888

Please sign in to comment.