You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2020/06/22 15:02:10 UTC

[activemq] branch activemq-5.15.x updated: [AMQ-7493] Fix RejectedExecutionException in the BrokerService

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch activemq-5.15.x
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/activemq-5.15.x by this push:
     new 59059e4  [AMQ-7493] Fix RejectedExecutionException in the BrokerService
59059e4 is described below

commit 59059e4ee76b8084c728205fbff2f85d7fc4afeb
Author: jbonofre <jb...@apache.org>
AuthorDate: Mon Jun 22 16:24:29 2020 +0200

    [AMQ-7493] Fix RejectedExecutionException in the BrokerService
    
    (cherry picked from commit 4e1df1979b963de468d873d19ec046361d18a039)
---
 .../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 b4cdcac..f74f257 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
@@ -2857,12 +2857,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.");
                 }
             });
         }