Module org.eclipse.persistence.core
Class Memoizer<A,V>
java.lang.Object
org.eclipse.persistence.internal.cache.Memoizer<A,V>
- All Implemented Interfaces:
LowLevelProcessor<A,
V>
Memoizer for computing resource expensive tasks asynchronously & concurrently.
Inspired by D. Lea. JCiP, 2nd edition. Addison-Wesley, 2006. pp.109
- Since:
- 2.6
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
Memoizer
public Memoizer()
-
-
Method Details
-
compute
Description copied from interface:LowLevelProcessor
Waits if necessary for the computation to complete, and then retrieves its result.- Specified by:
compute
in interfaceLowLevelProcessor<A,
V> - Parameters:
taskArg
- argument for computation- Throws:
InterruptedException
- if the current thread was interrupted while waiting
-
forget
Forgets result of the specified task. This allows to manually control size of internal cache.- Parameters:
task
- computable task, forming part of result keykey
- argument of computation
-
forgetAll
public void forgetAll()Forgets all cached results.
-