java.lang.Object
org.apache.jena.sparql.service.enhancer.claimingcache.RefDelegateBase<CompletableFuture<T>,Ref<CompletableFuture<T>>>
org.apache.jena.sparql.service.enhancer.claimingcache.RefFutureImpl<T>
All Implemented Interfaces:
AutoCloseable, Ref<CompletableFuture<T>>, RefDelegate<CompletableFuture<T>,Ref<CompletableFuture<T>>>, RefFuture<T>

public class RefFutureImpl<T> extends RefDelegateBase<CompletableFuture<T>,Ref<CompletableFuture<T>>> implements RefFuture<T>
  • Constructor Details

  • Method Details

    • acquire

      public RefFuture<T> acquire()
      Specified by:
      acquire in interface Ref<T>
      Specified by:
      acquire in interface RefFuture<T>
    • wrap

      public static <T> RefFuture<T> wrap(Ref<CompletableFuture<T>> delegate)
      A simple wrapping of an instance of Ref<CompletableFuture<T>> as a more handy instance of RefFuture<T>. All methods of the returned RefFuture delegate to the original Ref. Note, that RefFuture<T> is a sub-interface of Ref<CompletableFuture<T>>.
    • fromRef

      public static <T> RefFuture<T> fromRef(Ref<T> ref)
      Wrap an existing ref with completed future
    • fromFuture

      public static <T> RefFuture<T> fromFuture(CompletableFuture<Ref<T>> future, Object synchronizer)
      Create a ref that upon close cancels the future or closes the ref when it is available s
    • cancelFutureOrCloseRef

      public static void cancelFutureOrCloseRef(CompletableFuture<? extends Ref<?>> future)
    • cancelFutureOrCloseValue

      public static <T> void cancelFutureOrCloseValue(CompletableFuture<T> future, Consumer<? super T> valueCloseAction)
      Registers a whenComplete action that closes the value if loaded. Then immediately attempts to cancel the future.