private Computation<T> computedValue;
private Boolean busy;
- private T value;
+ private T value;
/**
* Constructs the compute guard
lock = aLock;
computedValue = aComputation;
busy = false;
- value = null;
+ value = null;
}
/**
return value;
}
}
-
+
/**
- * Gets the currently cached value. No recomputation is performed.
- * @return Cached value.
+ * Gets the currently cached value. No recomputation is performed.
+ *
+ * @return Cached value.
*/
- public T getCached() {
- synchronized(lock) {
- return value;
+ public T getCached() {
+ synchronized (lock) {
+ return value;
}
-
+
}
-
+
/**
- * Sets the value explicitly.
- * @param aValue value to set.
+ * Sets the value explicitly.
+ *
+ * @param aValue
+ * value to set.
*/
- public void set(T aValue) {
- synchronized(lock) {
+ public void set(T aValue) {
+ synchronized (lock) {
value = aValue;
}
}