You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Martin Styk (JIRA)" <ji...@apache.org> on 2016/08/31 10:42:20 UTC

[jira] [Created] (ARTEMIS-708) Incorrect ConcurrentHashSet.remove call in QueueImpl.DelayedAddRedistributor.run

Martin Styk created ARTEMIS-708:
-----------------------------------

             Summary: Incorrect ConcurrentHashSet.remove call in QueueImpl.DelayedAddRedistributor.run
                 Key: ARTEMIS-708
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-708
             Project: ActiveMQ Artemis
          Issue Type: Bug
          Components: Broker
    Affects Versions: 1.4.0
            Reporter: Martin Styk


There is a incorect {{remove}} method call on {{ConcurrentHashSet}} object in inner class {{QueueImpl.DelayedAddRedistributor}}. 
[Check this line on github | https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java#L2728]

Following is problematic part of code. 

{code:java}
public class QueueImpl implements Queue {

  private final Set<ScheduledFuture<?>> futures = new ConcurrentHashSet<>();

  private class DelayedAddRedistributor implements Runnable {
        @Override
        public void run() {
            .....
            futures.remove(this); 
            ..... 
       }
   }
}
{code}

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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)