Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-5819

Incorrect ConcurrentHashSet.remove call in QueueImpl.DelayedAddRedistributor.run

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.1.0.DR8
    • 7.1.0.DR3
    • ActiveMQ
    • None

      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<?>

              rh-ee-ataylor Andy Taylor
              mstyk_jira Martin Styk (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: