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 aCompletableFuture
if 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.Executor
executor
private static long
serialVersionUID
-
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 void
onRemoval(K key, 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.Object
writeReplace()
-
-
-
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(K key, @Nonnull java.util.concurrent.CompletableFuture<V> future, RemovalCause cause)
Description copied from interface:RemovalListener
Notifies 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:
onRemoval
in interfaceRemovalListener<K,V>
- Parameters:
key
- the key represented by this entry, ornull
if collectedfuture
- the value represented by this entry, ornull
if collectedcause
- the reason for which the entry was removed
-
writeReplace
java.lang.Object writeReplace()
-
-