Class RefFutureImpl<T>

    • Method Detail

      • 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>>.
        Type Parameters:
        T -
        Parameters:
        delegate -
        Returns:
      • 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,
                                                        java.util.function.Consumer<? super T> valueCloseAction)
        Registers a whenComplete action that closes the value if loaded. Then immediately attempts to cancel the future.
      • wrap2

        public static <T> RefFuture<T> wrap2​(Ref<? extends CompletableFuture<Ref<T>>> delegate)
        Wrap a Ref> as a RefFuture. This creates a new Ref that closes the delegate on close. This method does not acquire the delegate, so after wrapping the delegate should be considered as 'owned' by this wrapper; the delegate should no longer be closed directly.