Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-7493

ThreadPoolExecutor in BrokerService throws unneeded exception

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 5.16.0, 5.15.14
    • Broker
    • None

    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

       

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

       

       

      it must be

      // заполнитель кода
      
      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");
           }
      }

       

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

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jbonofre Jean-Baptiste Onofré
            shmakovaa Shmakov Alexey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 20m
              20m

              Slack

                Issue deployment