You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Joshua Bandur (JIRA)" <ji...@apache.org> on 2013/11/21 01:44:35 UTC
[jira] [Created] (CURATOR-75) InterProcessSemaphoreV2 does not
register changes to SharedCountReader while blocking
Joshua Bandur created CURATOR-75:
------------------------------------
Summary: InterProcessSemaphoreV2 does not register changes to SharedCountReader while blocking
Key: CURATOR-75
URL: https://issues.apache.org/jira/browse/CURATOR-75
Project: Apache Curator
Issue Type: Bug
Components: Recipes
Affects Versions: 2.3.0
Reporter: Joshua Bandur
When using InterProcessSemaphoreV2 with a SharedCountReader:
If the call to acquire() is currently blocking because no leases are available, and you increase the value that the SharedCountReader is tracking, acquire() does not notice the change, and continues to block until timeout. The expected behavior would be for it to notice the new value right away, completing the call successfully if there is now a sufficient number of leases available, or continuing to block if there still aren't enough.
I suspect the problem is in the SharedCountListener:
count.addListener
(
new SharedCountListener()
{
@Override
public void countHasChanged(SharedCountReader sharedCount, int newCount) throws Exception
{
InterProcessSemaphoreV2.this.maxLeases = newCount;
}
...
}
);
This event handler should probably call InterProcessSemaphoreV2.this.notifyAll() to wake any threads blocked in internalAcquire1Lease().
--
This message was sent by Atlassian JIRA
(v6.1#6144)