Spurious warning "unblocking after xxx ms" from FLUSH.blockMessageDuringFlush()
-------------------------------------------------------------------------------
Key: JGRP-1239
URL:
https://jira.jboss.org/browse/JGRP-1239
Project: JGroups
Issue Type: Bug
Affects Versions: 2.10
Environment: All
Reporter: Eric Sirianni
Assignee: Bela Ban
Priority: Minor
JavaDoc from java.util.concurrent.locks.Condition.await(...) indicates that FALSE is
returned if a timeout occurred.
{code}
/**
* ...
* @return {@code false} if the waiting time detectably elapsed
* before return from the method, else {@code true}
*/
boolean await(long time, TimeUnit unit) throws InterruptedException;
{code}
However, the JGroups code below is acting as if TRUE is returned if a timeout occurred.
{code}
private void blockMessageDuringFlush() {
boolean shouldSuspendByItself = false;
blockMutex.lock();
try {
while (isBlockingFlushDown) {
if (log.isDebugEnabled())
log.debug(localAddress + ": blocking for " + (timeout <=
0 ? "ever" : timeout + "ms"));
shouldSuspendByItself = notBlockedDown.await(timeout,
TimeUnit.MILLISECONDS);
}
if (shouldSuspendByItself) {
isBlockingFlushDown = false;
log.warn(localAddress + ": unblocking after " + timeout +
"ms");
flush_promise.setResult(Boolean.TRUE);
notBlockedDown.signalAll();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
blockMutex.unlock();
}
}
{code}
This causes spurious WARNING level messages to be logged by JGroups when in fact no
timeout occurred.
The fix is simple:
{noformat}
< shouldSuspendByItself = notBlockedDown.await(timeout, TimeUnit.MILLISECONDS);
--
shouldSuspendByItself = !notBlockedDown.await(timeout,
TimeUnit.MILLISECONDS);
{noformat}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira