You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Justin Bertram (JIRA)" <ji...@apache.org> on 2016/10/19 19:36:58 UTC
[jira] [Resolved] (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:all-tabpanel ]
Justin Bertram resolved ARTEMIS-708.
------------------------------------
Resolution: Fixed
Fix Version/s: 1.5.0
> 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
> Fix For: 1.5.0
>
>
> 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)