Merge pull request #544 from jbonofre/AMQ-7493

[AMQ-7493] Fix RejectedExecutionException in the BrokerService
This commit is contained in:
Jean-Baptiste Onofré 2020-06-22 17:00:52 +02:00 committed by GitHub
commit 937c31e036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -2860,12 +2860,12 @@ public class BrokerService implements Service {
@Override @Override
public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor) { public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor) {
try { 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) { } catch (InterruptedException e) {
throw new RejectedExecutionException("Interrupted waiting for BrokerService.worker"); throw new RejectedExecutionException("Interrupted waiting for BrokerService.worker");
} }
throw new RejectedExecutionException("Timed Out while attempting to enqueue Task.");
} }
}); });
} }