You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Marshall Schor (JIRA)" <de...@uima.apache.org> on 2013/11/18 22:49:20 UTC
[jira] [Commented] (UIMA-3433) UIMA-AS cleanup of semaphore testing
wrong thing
[ https://issues.apache.org/jira/browse/UIMA-3433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13825814#comment-13825814 ]
Marshall Schor commented on UIMA-3433:
--------------------------------------
Wrong fix. The intent of this is to allow any threads waiting on the availability of what this semaphore is gating, to resume (and presumably clean themselves up). So the right logic is something like:
{code:borderStyle=solid}
while (...semaphore.hasQueuedThreads() ) {
semaphore.release();
Thread.sleep(1); // give other thread a chance to stop being queued
}
{code}
> UIMA-AS cleanup of semaphore testing wrong thing
> ------------------------------------------------
>
> Key: UIMA-3433
> URL: https://issues.apache.org/jira/browse/UIMA-3433
> Project: UIMA
> Issue Type: Bug
> Components: Async Scaleout
> Affects Versions: 2.4.2AS
> Environment: Fails on IBM Java 7 SR5 with error saying too many permits. Earlier versions of this Java (e.g. v 6) don't give this message.
> Reporter: Marshall Schor
> Assignee: Marshall Schor
> Priority: Minor
>
> There is a test to clear a semaphore in uima-as as part of the stop method, which does
> {code:borderStyle=solid}
> // release all permits
> if ( semaphore != null ) {
> while ( semaphore.availablePermits() > 0) {
> semaphore.release();
> }
> }
> {code}
> Stepping through this shows that each call to release() increases (not decreases) the number of availablePermits.
> Replace with drainPermits(), which appears to be the intent.
--
This message was sent by Atlassian JIRA
(v6.1#6144)