Class Async.AsyncRemovalListener<K,V>
- java.lang.Object
-
- com.github.benmanes.caffeine.cache.Async.AsyncRemovalListener<K,V>
-
- All Implemented Interfaces:
RemovalListener<K,java.util.concurrent.CompletableFuture<V>>,java.io.Serializable
- Enclosing class:
- Async
static final class Async.AsyncRemovalListener<K,V> extends java.lang.Object implements RemovalListener<K,java.util.concurrent.CompletableFuture<V>>, java.io.Serializable
A removal listener that asynchronously forwards the value stored in aCompletableFutureif successful to the user-supplied removal listener.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) RemovalListener<K,V>delegate(package private) java.util.concurrent.Executorexecutorprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description AsyncRemovalListener(RemovalListener<K,V> delegate, java.util.concurrent.Executor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonRemoval(@Nullable K key, @Nullable java.util.concurrent.CompletableFuture<V> future, RemovalCause cause)Notifies the listener that a removal occurred at some point in the past.(package private) java.lang.ObjectwriteReplace()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
delegate
final RemovalListener<K,V> delegate
-
executor
final java.util.concurrent.Executor executor
-
-
Constructor Detail
-
AsyncRemovalListener
AsyncRemovalListener(RemovalListener<K,V> delegate, java.util.concurrent.Executor executor)
-
-
Method Detail
-
onRemoval
public void onRemoval(@Nullable K key, @Nullable java.util.concurrent.CompletableFuture<V> future, RemovalCause cause)
Description copied from interface:RemovalListenerNotifies the listener that a removal occurred at some point in the past.This does not always signify that the key is now absent from the cache, as it may have already been re-added.
- Specified by:
onRemovalin interfaceRemovalListener<K,V>- Parameters:
key- the key represented by this entry, ornullif collectedfuture- the value represented by this entry, ornullif collectedcause- the reason for which the entry was removed
-
writeReplace
java.lang.Object writeReplace()
-
-