Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-708

Incorrect ConcurrentHashSet.remove call in QueueImpl.DelayedAddRedistributor.run

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4.0
    • 1.5.0
    • Broker
    • None

    Description

      There is a incorect remove method call on ConcurrentHashSet object in inner class QueueImpl.DelayedAddRedistributor.
      Check this line on github

      Following is problematic part of code.

      public class QueueImpl implements Queue {
      
        private final Set<ScheduledFuture<?>> futures = new ConcurrentHashSet<>();
      
        private class DelayedAddRedistributor implements Runnable {
              @Override
              public void run() {
                  .....
                  futures.remove(this); 
                  ..... 
             }
         }
      }
      

      futures is ConcurrentHashSet of ScheduledFuture<?>. However, QueueImpl.DelayedAddRedistributor.run() calls futures.remove(this), where this is an instance of QueueImpl.DelayedAddRedistributor class. It is not ScheduledFuture<?>. remove method never removes instance of QueueImpl.DelayedAddRedistributor class, since it stores Scheduled Futures.

      QueueImpl$DelayedAddRedistributor is incompatible with expected argument type java.util.concurrent.ScheduledFuture<?>

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mstyk Martin Styk
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: