ahc.util
Class SynchronizedParamGetCode
java.lang.Object
|
+--ahc.util.SynchronizedParamGetCode
- public abstract class SynchronizedParamGetCode
- extends java.lang.Object
This class and performs a blocking wait on a lock and then retrieves an object.
The get operation first waits until a precondition is met and it can acquire a monitor, or until a
timout is reached. The monitor is passed in to the constructor, and the precondition must be provided
by implementing an abstract method.
If the precondition is met and the lock acquired, the actuel result is retrieved by calling the abstract
hook "getUnsynchronized".
This implementation retrieves the result passing one parameter to the getUnsynchronized method.
- Author:
- Arno Haase
Method Summary |
java.lang.Object |
get(java.lang.Object parameter,
boolean blocking)
|
java.lang.Object |
get(java.lang.Object parameter,
int timeoutMillis)
|
abstract java.lang.Object |
getUnsynchronized(java.lang.Object parameter)
|
abstract boolean |
precondition(java.lang.Object parameter)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SynchronizedParamGetCode
public SynchronizedParamGetCode(java.lang.Object lock)
get
public java.lang.Object get(java.lang.Object parameter,
int timeoutMillis)
throws java.lang.InterruptedException,
TimeoutException
java.lang.InterruptedException
TimeoutException
get
public java.lang.Object get(java.lang.Object parameter,
boolean blocking)
throws java.lang.InterruptedException
java.lang.InterruptedException
precondition
public abstract boolean precondition(java.lang.Object parameter)
getUnsynchronized
public abstract java.lang.Object getUnsynchronized(java.lang.Object parameter)