java.lang.Object
org.jgroups.util.CondVar
- public class CondVar
- extends java.lang.Object
Class that checks on a condition and - if condition doesn't match the expected result - waits until the result
matches the expected result, or a timeout occurs. First version used WaitableBoolean from util.concurrent, but
that class would not allow for timeouts.
- Version:
- $Id: CondVar.java,v 1.3 2004/12/31 14:10:40 belaban Exp $
cond
java.lang.Object cond
name
final java.lang.String name
lock
final java.lang.Object lock
CondVar
public CondVar(java.lang.String name,
java.lang.Object cond)
CondVar
public CondVar(java.lang.String name,
java.lang.Object cond,
java.lang.Object lock)
get
public java.lang.Object get()
set
public void set(java.lang.Object result)
- Sets the result
getLock
public java.lang.Object getLock()
waitUntilWithTimeout
public void waitUntilWithTimeout(java.lang.Object result,
long timeout)
throws org.jgroups.TimeoutException
- Waits until the condition matches the expected result. Returns immediately if they match, otherwise waits
for timeout milliseconds or until the results match.
waitUntil
public void waitUntil(java.lang.Object result,
long timeout)
- Waits until the condition matches the expected result. Returns immediately if they match, otherwise waits
for timeout milliseconds or until the results match. This method doesn't throw a TimeoutException
waitUntil
public void waitUntil(java.lang.Object result)
_waitUntilWithTimeout
private void _waitUntilWithTimeout(java.lang.Object result,
long timeout)
throws org.jgroups.TimeoutException
doWait
void doWait()
doWait
void doWait(long timeout)
match
private boolean match(java.lang.Object o1,
java.lang.Object o2)
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object
- Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string
concatenation with this object. If the result is
null, string concatenation will instead
use "null".
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode()).