[AMQ-7493] Fix RejectedExecutionException in the BrokerService

This commit is contained in:
jbonofre 2020-06-22 16:24:29 +02:00
parent 07cf49ed48
commit 4e1df1979b
1 changed files with 3 additions and 3 deletions

View File

@ -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.");
}
});
}