[
https://issues.jboss.org/browse/ISPN-2497?page=com.atlassian.jira.plugin....
]
Anna Manukyan edited comment on ISPN-2497 at 11/13/12 7:29 AM:
---------------------------------------------------------------
I think I've found the reason why this happened, and this is really funny :D
The following happens:
I'm instantiating QueueingListener for passing it to
DistributedExecutionCompletionService. The instantiation is done by using another
DistributedExecutionCompletionService, which is created using the one-parameter
constructor.
Then I'm passing the created instance of QueuingListener to
DistributedExecutionCompletionService 3-parameter constructor. So I'm getting new
DistributedExecutionCompletionService which has it's own completionQueue and listener,
but the listener belongs to another DistributedExecutionCompletionService with it's
own completionQueue.
DistributedExecutionCompletionService.QueueingListener listener = new
DistributedExecutionCompletionService<Integer>(des).new QueueingListener();
DistributedExecutionCompletionService<Integer> decs = new
DistributedExecutionCompletionService<Integer>(des, queue, listener);
So, when the callable is executed and added to completionQueue (in listener), it is added
to the completionQueue of firstly created DistributedExecutionCompletionService, and not
to the completionQueue of the DECS created with 3 parameters, which leads to that the
working queue is always empty, and the take() method enters into never ending loop of
waiting for completed task.
This means, that it would not be possible to instantiate
DistributedExecutionCompletionService with 3-parameter constructor (des, queue, listener)
even if the instantiation is done in the same package, only to override it with custom
provided listener.
I guess this bug is invalid, right? What do you think?
was (Author: amanukyan):
I think I've found the reason why this happened, and this is really funny :D
The following happens:
I'm instantiating QueueingListener for passing it to
DistributedExecutionCompletionService. The instantiation is done by using another
DistributedExecutionCompletionService, which is created using the one-parameter
constructor.
Then I'm passing the created instance of QueuingListener to
DistributedExecutionCompletionService 3-parameter constructor. So I'm getting new
DistributedExecutionCompletionService which has it's own completionQueue and listener,
but the listener belongs to another DistributedExecutionCompletionService with it's
own completionQueue.
So, when the callable is executed and added to completionQueue (in listener), it is added
to the completionQueue of firstly created DistributedExecutionCompletionService, and not
to the completionQueue of the DECS created with 3 parameters, which leads to that the
working queue is always empty, and the take() method enters into never ending loop of
waiting for completed task.
This means, that it would not be possible to instantiate
DistributedExecutionCompletionService with 3-parameter constructor (des, queue, listener)
even if the instantiation is done in the same package, only to override it with custom
provided listener.
I guess this bug is invalid, right? What do you think?
Test for DistributedExecutionCompletionService hangs, if
instantiation is done by passing queue
-----------------------------------------------------------------------------------------------
Key: ISPN-2497
URL:
https://issues.jboss.org/browse/ISPN-2497
Project: Infinispan
Issue Type: Bug
Components: Distributed Execution and Map/Reduce
Reporter: Anna Manukyan
Assignee: Vladimir Blagojevic
Hi,
during writing tests for DistributedExecutionCompletionService, the following issue
raised:
I'm creating DistributedExecutionCompletionService with constructor
protected DistributedExecutionCompletionService(DistributedExecutorService executor,
BlockingQueue<NotifyingFuture<V>> completionQueue, QueueingListener listener)
the constructor is protected, and my test is located in the same package.
As a completionQueue I'm passing ArrayBlockingQueue, and as a listener I'm
passing my created QueueingListener instance.
When I submit simple callable to the service which just should return 1, and then call
take() method of the completion service, the suite hangs. I've added some log for
finding out whether the task is executed and listener is notified, and yes - the listener
is notified and the queue is filled with the completed future task. But the take() method
hangs and doesn't return the value.
If I use poll() instead of take(), and poll() the completed task after waiting for some
time, the returned value is null, although it is already in the completion queue.
The test reproducing the issue is:
https://github.com/andyuk1986/infinispan/blob/DIST_EXEC_TESTS/core/src/te...
(testBasicInvocationWithBlockingQueueAndListener()).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira