Class LocalCache.LoadingValueReference<K,​V>

    • Constructor Detail

      • LoadingValueReference

        public LoadingValueReference()
    • Method Detail

      • isLoading

        public boolean isLoading()
        Description copied from interface: LocalCache.ValueReference
        Returns true if a new value is currently loading, regardless of whether or not there is an existing value. It is assumed that the return value of this method is constant for any given ValueReference instance.
        Specified by:
        isLoading in interface LocalCache.ValueReference<K,​V>
      • isActive

        public boolean isActive()
        Description copied from interface: LocalCache.ValueReference
        Returns true if this reference contains an active value, meaning one that is still considered present in the cache. Active values consist of live values, which are returned by cache lookups, and dead values, which have been evicted but awaiting removal. Non-active values consist strictly of loading values, though during refresh a value may be both active and loading.
        Specified by:
        isActive in interface LocalCache.ValueReference<K,​V>
      • set

        public boolean set​(V newValue)
      • setException

        public boolean setException​(java.lang.Throwable t)
      • fullyFailedFuture

        private ListenableFuture<V> fullyFailedFuture​(java.lang.Throwable t)
      • compute

        public V compute​(K key,
                         java.util.function.BiFunction<? super K,​? super V,​? extends V> function)
      • elapsedNanos

        public long elapsedNanos()
      • waitForValue

        public V waitForValue()
                       throws java.util.concurrent.ExecutionException
        Description copied from interface: LocalCache.ValueReference
        Waits for a value that may still be loading. Unlike get(), this method can block (in the case of FutureValueReference).
        Specified by:
        waitForValue in interface LocalCache.ValueReference<K,​V>
        Throws:
        java.util.concurrent.ExecutionException - if the loading thread throws an exception