Package ghidra.async
Interface AsyncUtils
public interface AsyncUtils
Some conveniences when dealing with Java's
CompletableFutures.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Cleanerstatic final ExecutorServicestatic final ExecutorService -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T> BiFunction<T, Throwable, T> copyTo(CompletableFuture<T> dest) Create aBiFunctionthat copies a result from oneCompletableFutureto anotherstatic <T> CompletableFuture<T> nil()static ThrowableUnwrapCompletionExceptions andExecutionExceptions to get the real cause
-
Field Details
-
CLEANER
-
FRAMEWORK_EXECUTOR
-
SWING_EXECUTOR
-
-
Method Details
-
nil
-
unwrapThrowable
UnwrapCompletionExceptions andExecutionExceptions 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 aBiFunctionthat copies a result from oneCompletableFutureto 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
destCFto be completed identically tosourceCF. The returned future fromhandlewill also behave identically tosource CF, except thatdestCFis 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
-