[
https://issues.apache.org/jira/browse/CURATOR-75?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13828413#comment-13828413
]
Jordan Zimmerman commented on CURATOR-75:
-----------------------------------------
Can you provide a patch?
> 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)