You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/10/19 07:56:58 UTC

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

    [ https://issues.apache.org/jira/browse/ARTEMIS-708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15587975#comment-15587975 ] 

ASF GitHub Bot commented on ARTEMIS-708:
----------------------------------------

GitHub user bayern39 opened a pull request:

    https://github.com/apache/activemq-artemis/pull/851

    [ARTEMIS-708]  Incorrect ConcurrentHashSet.remove call in QueueImpl.DelayedAddRedistributor.run

    https://issues.apache.org/jira/browse/ARTEMIS-708

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/bayern39/activemq-artemis ARTEMIS-708

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/851.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #851
    
----
commit 3dfa5db96a5522553f34537d8b355433163a9ed5
Author: bayern39 <ja...@163.com>
Date:   2016-10-19T07:53:10Z

    [ARTEMIS-708] Incorrect ConcurrentHashSet.remove call in QueueImpl.DelayedAddRedistributor.run

----


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