Class RefFutureImpl<T>
java.lang.Object
org.aksw.commons.util.ref.RefDelegateBase<CompletableFuture<T>, Ref<CompletableFuture<T>>>
org.aksw.commons.util.ref.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>
-
Field Summary
Fields inherited from class RefDelegateBase
delegate -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacquire()static voidcancelFutureOrCloseRef(CompletableFuture<? extends Ref<?>> future) static <T> voidcancelFutureOrCloseValue(CompletableFuture<T> future, Consumer<? super T> valueCloseAction) Registers a whenComplete action that closes the value if loaded.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 sstatic <T> RefFuture<T> Wrap an existing ref with completed futurestatic <T> RefFuture<T> wrap(Ref<CompletableFuture<T>> delegate) A simple wrapping of an instance ofRef<CompletableFuture<T>>as a more handy instance ofRefFuture<T>.static <T> RefFuture<T> wrap2(Ref<? extends CompletableFuture<Ref<T>>> delegate) Wrap a Refinvalid input: '<'RefFuture> as a RefFuture . static <T> RefFuture<T> wrap3(Ref<? extends Ref<? extends CompletableFuture<T>>> delegate) Methods inherited from class RefDelegateBase
getDelegateMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Ref
acquireMappedMethods inherited from interface RefDelegate
acquire, close, get, getAcquisitionStackTrace, getCloseStackTrace, getCloseTriggerStackTrace, getDelegate, getRootRef, getSynchronizer, isAlive, isClosedMethods inherited from interface RefFuture
acquireTransformed, acquireTransformedAndCloseThis, await
-
Constructor Details
-
RefFutureImpl
-
-
Method Details
-
acquire
-
wrap
A simple wrapping of an instance ofRef<CompletableFuture<T>>as a more handy instance ofRefFuture<T>. All methods of the returned RefFuture delegate to the original Ref. Note, thatRefFuture<T>is a sub-interface ofRef<CompletableFuture<T>>.- Type Parameters:
T-- Parameters:
delegate-- Returns:
-
fromRef
-
fromFuture
Create a ref that upon close cancels the future or closes the ref when it is available s -
cancelFutureOrCloseRef
-
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. -
wrap2
Wrap a Refinvalid input: '<'RefFuture> 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. -
wrap3
-