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.0.2
            Reporter: Tobias Rübner
             Fix For: 0.0.2


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


Reply via email to