[ 
https://issues.apache.org/jira/browse/AMQ-7493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shmakov Alexey updated AMQ-7493:
--------------------------------
    Description: 
Hello, i found the bug in
[https://github.com/apache/activemq/blob/master/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java#L2859]

 
{code:java}
new RejectedExecutionHandler() {
    @Override
    public void rejectedExecution(final Runnable r, final ThreadPoolExecutor 
executor) {
       try{ 
          executor.getQueue().offer(r, 60, TimeUnit.SECONDS); 
       }
       catch (InterruptedException e) { 
         throw new RejectedExecutionException("Interrupted waiting for 
BrokerService.worker"); 
       }
       throw new RejectedExecutionException("Timed Out while attempting to 
enqueue Task.");
    }
 }
{code}
 

 

it must be
{code:java}
// заполнитель кода

public void rejectedExecution(final Runnable r, final ThreadPoolExecutor 
executor) {
     try { 
          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");
     }
}{code}
 

because on success method offer must return true 
 P.s. sorry for my horrible english

  was:
Hello, i found the bug in
 
[https://github.com/apache/activemq/blob/master/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java]

on row 2859:

 
{code:java}

new RejectedExecutionHandler() {
    @Override
    public void rejectedExecution(final Runnable r, final ThreadPoolExecutor 
executor) {
       try{ 
          executor.getQueue().offer(r, 60, TimeUnit.SECONDS); 
       }
       catch (InterruptedException e) { 
         throw new RejectedExecutionException("Interrupted waiting for 
BrokerService.worker"); 
       }
       throw new RejectedExecutionException("Timed Out while attempting to 
enqueue Task.");
    }
 }
{code}
 

 

it must be
{code:java}
// заполнитель кода

public void rejectedExecution(final Runnable r, final ThreadPoolExecutor 
executor) {
     try { 
          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");
     }
}{code}
 

because on success method offer must return true 
 P.s. sorry for my horrible english


> ThreadPoolExecutor in BrokerService throws unneeded exception
> -------------------------------------------------------------
>
>                 Key: AMQ-7493
>                 URL: https://issues.apache.org/jira/browse/AMQ-7493
>             Project: ActiveMQ
>          Issue Type: Task
>          Components: Broker
>            Reporter: Shmakov Alexey
>            Priority: Minor
>
> Hello, i found the bug in
> [https://github.com/apache/activemq/blob/master/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java#L2859]
>  
> {code:java}
> new RejectedExecutionHandler() {
>     @Override
>     public void rejectedExecution(final Runnable r, final ThreadPoolExecutor 
> executor) {
>        try{ 
>           executor.getQueue().offer(r, 60, TimeUnit.SECONDS); 
>        }
>        catch (InterruptedException e) { 
>          throw new RejectedExecutionException("Interrupted waiting for 
> BrokerService.worker"); 
>        }
>        throw new RejectedExecutionException("Timed Out while attempting to 
> enqueue Task.");
>     }
>  }
> {code}
>  
>  
> it must be
> {code:java}
> // заполнитель кода
> public void rejectedExecution(final Runnable r, final ThreadPoolExecutor 
> executor) {
>      try { 
>           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");
>      }
> }{code}
>  
> because on success method offer must return true 
>  P.s. sorry for my horrible english



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to