From d14c0de3356897c30ca20b96cf8089051674426b Mon Sep 17 00:00:00 2001 From: brusdev Date: Thu, 20 Jun 2019 16:20:11 +0200 Subject: [PATCH] ARTEMIS-2385 Log header for rejecting message with too large header Fix test and warning condition to avoid false issues. --- .../artemis/protocol/amqp/proton/AMQPConnectionContext.java | 5 ++++- .../protocol/amqp/proton/AMQPConnectionContextTest.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java index 3790f365ac..35ea4f59b0 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java @@ -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; } } } diff --git a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContextTest.java b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContextTest.java index 8bdda7ec75..13b0258d2f 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContextTest.java +++ b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContextTest.java @@ -81,6 +81,6 @@ public class AMQPConnectionContextTest { connectionContext.close(null); - Assert.assertEquals(0, scheduledPool.getTaskCount()); + Assert.assertEquals(0, scheduledPool.getQueue().size()); } }