This is an automated email from the ASF dual-hosted git repository. jbonofre pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/activemq.git
The following commit(s) were added to refs/heads/master by this push: new 4e1df19 [AMQ-7493] Fix RejectedExecutionException in the BrokerService new 937c31e Merge pull request #544 from jbonofre/AMQ-7493 4e1df19 is described below commit 4e1df1979b963de468d873d19ec046361d18a039 Author: jbonofre <jbono...@apache.org> AuthorDate: Mon Jun 22 16:24:29 2020 +0200 [AMQ-7493] Fix RejectedExecutionException in the BrokerService --- .../src/main/java/org/apache/activemq/broker/BrokerService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java b/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java index 419b4db..0c7044f 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java @@ -2860,12 +2860,12 @@ public class BrokerService implements Service { @Override public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor) { try { - executor.getQueue().offer(r, 60, TimeUnit.SECONDS); + if (!executor.getQueue().offer(r, 60, TimeUnit.SECONDS)) { + throw new RejectedExecutionException("Timed Out while attempting to enqueue Task."); + } } catch (InterruptedException e) { throw new RejectedExecutionException("Interrupted waiting for BrokerService.worker"); } - - throw new RejectedExecutionException("Timed Out while attempting to enqueue Task."); } }); }