This closes #2721
This commit is contained in:
commit
7e6efb26e2
|
@ -196,8 +196,11 @@ public class AMQPConnectionContext extends ProtonInitializable implements EventH
|
|||
|
||||
if (scheduledPool != null && scheduledPool instanceof ThreadPoolExecutor &&
|
||||
scheduledFuture != null && scheduledFuture instanceof Runnable) {
|
||||
if (!((ThreadPoolExecutor) scheduledPool).remove((Runnable) scheduledFuture)) {
|
||||
if (!((ThreadPoolExecutor) scheduledPool).remove((Runnable) scheduledFuture) &&
|
||||
!scheduledFuture.isCancelled() && !scheduledFuture.isDone()) {
|
||||
log.warn("Scheduled task can't be removed from scheduledPool.");
|
||||
} else {
|
||||
scheduledFuture = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,6 @@ public class AMQPConnectionContextTest {
|
|||
|
||||
connectionContext.close(null);
|
||||
|
||||
Assert.assertEquals(0, scheduledPool.getTaskCount());
|
||||
Assert.assertEquals(0, scheduledPool.getQueue().size());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue