Class 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 a CompletableFuture if successful to the user-supplied removal listener.
    • 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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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 interface RemovalListener<K,​V>
        Parameters:
        key - the key represented by this entry, or null if collected
        future - the value represented by this entry, or null if collected
        cause - the reason for which the entry was removed
      • writeReplace

        java.lang.Object writeReplace()