org.jetbrains.jet.storage
Class LockBasedStorageManager
java.lang.Object
org.jetbrains.jet.storage.LockBasedStorageManager
- All Implemented Interfaces:
- StorageManager
- Direct Known Subclasses:
- LockBasedLazyResolveStorageManager
public class LockBasedStorageManager
- extends java.lang.Object
- implements StorageManager
Method Summary |
|
compute(jet.Function0<T> computable)
|
|
createLazyValue(jet.Function0<T> computable)
|
|
createLazyValueWithPostCompute(jet.Function0<T> computable,
jet.Function1<java.lang.Boolean,T> onRecursiveCall,
jet.Function1<T,jet.Unit> postCompute)
|
|
createMemoizedFunction(jet.Function1<K,V> compute)
Given a function compute: K -> V create a memoized version of it that computes a value only once for each key |
protected
|
createMemoizedFunction(jet.Function1<K,V> compute,
java.util.concurrent.ConcurrentMap<K,java.lang.Object> map)
|
|
createMemoizedFunctionWithNullableValues(jet.Function1<K,V> compute)
|
protected
|
createMemoizedFunctionWithNullableValues(jet.Function1<K,V> compute,
java.util.concurrent.ConcurrentMap<K,java.lang.Object> map)
|
|
createNullableLazyValue(jet.Function0<T> computable)
|
|
createNullableLazyValueWithPostCompute(jet.Function0<T> computable,
jet.Function1<T,jet.Unit> postCompute)
postCompute is called after the value is computed, but before any other thread sees it (the current thread may
see it in between) |
|
createRecursionTolerantLazyValue(jet.Function0<T> computable,
T onRecursiveCall)
|
|
createRecursionTolerantNullableLazyValue(jet.Function0<T> computable,
T onRecursiveCall)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NO_LOCKS
public static final StorageManager NO_LOCKS
lock
protected final java.util.concurrent.locks.Lock lock
LockBasedStorageManager
public LockBasedStorageManager()
createMemoizedFunction
@NotNull
public <K,V> MemoizedFunctionToNotNull<K,V> createMemoizedFunction(@NotNull
jet.Function1<K,V> compute)
- Description copied from interface:
StorageManager
- Given a function compute: K -> V create a memoized version of it that computes a value only once for each key
- Specified by:
createMemoizedFunction
in interface StorageManager
- Parameters:
compute
- the function to be memoized
createMemoizedFunction
@NotNull
protected <K,V> MemoizedFunctionToNotNull<K,V> createMemoizedFunction(@NotNull
jet.Function1<K,V> compute,
@NotNull
java.util.concurrent.ConcurrentMap<K,java.lang.Object> map)
createMemoizedFunctionWithNullableValues
@NotNull
public <K,V> MemoizedFunctionToNullable<K,V> createMemoizedFunctionWithNullableValues(@NotNull
jet.Function1<K,V> compute)
- Specified by:
createMemoizedFunctionWithNullableValues
in interface StorageManager
createMemoizedFunctionWithNullableValues
@NotNull
protected <K,V> MemoizedFunctionToNullable<K,V> createMemoizedFunctionWithNullableValues(@NotNull
jet.Function1<K,V> compute,
@NotNull
java.util.concurrent.ConcurrentMap<K,java.lang.Object> map)
createLazyValue
@NotNull
public <T> NotNullLazyValue<T> createLazyValue(@NotNull
jet.Function0<T> computable)
- Specified by:
createLazyValue
in interface StorageManager
createRecursionTolerantLazyValue
@NotNull
public <T> NotNullLazyValue<T> createRecursionTolerantLazyValue(@NotNull
jet.Function0<T> computable,
@NotNull
T onRecursiveCall)
- Specified by:
createRecursionTolerantLazyValue
in interface StorageManager
createLazyValueWithPostCompute
@NotNull
public <T> NotNullLazyValue<T> createLazyValueWithPostCompute(@NotNull
jet.Function0<T> computable,
jet.Function1<java.lang.Boolean,T> onRecursiveCall,
@NotNull
jet.Function1<T,jet.Unit> postCompute)
- Specified by:
createLazyValueWithPostCompute
in interface StorageManager
onRecursiveCall
- is called if the computation calls itself recursively.
The parameter to it is true
for the first call, false
otherwise.
If onRecursiveCall
is null
, an exception will be thrown on a recursive call,
otherwise it's executed and its result is returnedpostCompute
- is called after the value is computed, but before any other thread sees it
createNullableLazyValue
@NotNull
public <T> NullableLazyValue<T> createNullableLazyValue(@NotNull
jet.Function0<T> computable)
- Specified by:
createNullableLazyValue
in interface StorageManager
createRecursionTolerantNullableLazyValue
@NotNull
public <T> NullableLazyValue<T> createRecursionTolerantNullableLazyValue(@NotNull
jet.Function0<T> computable,
T onRecursiveCall)
- Specified by:
createRecursionTolerantNullableLazyValue
in interface StorageManager
createNullableLazyValueWithPostCompute
@NotNull
public <T> NullableLazyValue<T> createNullableLazyValueWithPostCompute(@NotNull
jet.Function0<T> computable,
@NotNull
jet.Function1<T,jet.Unit> postCompute)
- Description copied from interface:
StorageManager
postCompute
is called after the value is computed, but before any other thread sees it (the current thread may
see it in between)
- Specified by:
createNullableLazyValueWithPostCompute
in interface StorageManager
compute
public <T> T compute(@NotNull
jet.Function0<T> computable)
- Specified by:
compute
in interface StorageManager