org.wamblee.cache
Interface ComputedValue.Computation<T>

Type Parameters:
T - Type of object to compute.
Enclosing class:
ComputedValue<T>

public static interface ComputedValue.Computation<T>

Computation


Method Summary
 T compute()
          Computes the object.
 boolean isOutOfDate()
          Checks whether the object is out of date.
 

Method Detail

isOutOfDate

boolean isOutOfDate()
Checks whether the object is out of date. This will be invoked while holding the lock passed at construction of the compute guard. Any runtime exceptions thrown are passed back through the ComputedValue.get().

Returns:
True iff recomputation is necessary.

compute

T compute()
Computes the object. This will be invoked while not holding the lock passed at construction of the compute guard. It is guaranteed that per ComputeGuard, no concurrent calls to compute() are done. Any runtime exceptions thrown are passed back through the ComputedValue.get().

Returns:
Computed object.


Copyright © 2011. All Rights Reserved.