You are viewing a plain text version of this content. The canonical link for it is here.
Posted to droids-dev@incubator.apache.org by "Richard Frovarp (JIRA)" <ji...@apache.org> on 2012/06/15 15:18:42 UTC

[jira] [Closed] (DROIDS-166) SimpleTaskQueueWithHistory is not thread safe

     [ https://issues.apache.org/jira/browse/DROIDS-166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Frovarp closed DROIDS-166.
----------------------------------

    Resolution: Fixed

Was fixed in the 0.2.x codebase.
                
> SimpleTaskQueueWithHistory is not thread safe
> ---------------------------------------------
>
>                 Key: DROIDS-166
>                 URL: https://issues.apache.org/jira/browse/DROIDS-166
>             Project: Droids
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 0.2.0
>            Reporter: Tobias Rübner
>             Fix For: 0.2.0
>
>         Attachments: DROIDS-166.patch
>
>
> The implementation extends java.util.LinkedList which is not thread safe.
> Running droids with the MultiThreadedTaskMaster could spawn endless new threads.
> {code}
> Exception in thread "pool-1-thread-12808" java.util.NoSuchElementException
>         at java.util.LinkedList.remove(LinkedList.java:788)
>         at java.util.LinkedList.removeFirst(LinkedList.java:134)
>         at java.util.LinkedList.poll(LinkedList.java:470)
>         at org.apache.droids.impl.MultiThreadedTaskMaster$TaskExecutor.run(MultiThreadedTaskMaster.java:336)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
> {code}
> I fixed this extending the SimpleTaskQueueWithHistory from java.util.concurrent.LinkedBlockingQueue and rewriting the add and offer methods.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira