Package ghidra.async
Interface AsyncUtils
public interface AsyncUtils
Some conveniences when dealing with Java's
CompletableFuture
s.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Cleaner
static final ExecutorService
static final ExecutorService
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T> BiFunction
<T, Throwable, T> copyTo
(CompletableFuture<T> dest) Create aBiFunction
that copies a result from oneCompletableFuture
to anotherstatic <T> CompletableFuture
<T> nil()
static Throwable
UnwrapCompletionException
s andExecutionException
s to get the real cause
-
Field Details
-
CLEANER
-
FRAMEWORK_EXECUTOR
-
SWING_EXECUTOR
-
-
Method Details
-
nil
-
unwrapThrowable
UnwrapCompletionException
s andExecutionException
s to get the real cause- Parameters:
e
- the (usually wrapped) exception- Returns:
- the nearest cause in the chain that is not a
CompletionException
-
copyTo
Create aBiFunction
that copies a result from oneCompletableFuture
to anotherThe returned function is suitable for use in
CompletableFuture.handle(BiFunction)
and related methods, as in:sourceCF().handle(AsyncUtils.copyTo(destCF));
This will effectively cause
destCF
to be completed identically tosourceCF
. The returned future fromhandle
will also behave identically tosource CF
, except thatdestCF
is guaranteed to complete before the returned future does.- Type Parameters:
T
- the type of the future result- Parameters:
dest
- the future to copy into- Returns:
- a function which handles the source future
-