Class SmallRyeManagedExecutor
- All Implemented Interfaces:
AutoCloseable,Executor,ExecutorService,org.eclipse.microprofile.context.ManagedExecutor
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionSmallRyeManagedExecutor(int maxAsync, int maxQueued, SmallRyeThreadContext threadContext, ExecutorService executor, String injectionPointName) -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long timeout, TimeUnit unit) builder()<U> CompletableFuture<U> completedFuture(U value) <U> CompletionStage<U> completedStage(U value) <T> CompletableFuture<T> copy(CompletableFuture<T> stage) Returns a newCompletableFuturethat is completed by the completion of the specified stage.<T> CompletionStage<T> copy(CompletionStage<T> stage) Returns a newCompletionStagethat is completed by the completion of the specified stage.void<U> CompletableFuture<U> <U> CompletionStage<U> failedStage(Throwable ex) intintReturns aThreadContextwhich has the same propagation settings as thisManagedExecutor, which uses thisManagedExecutoras its default executor.invokeAll(Collection<? extends Callable<T>> tasks) invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) <T> TinvokeAny(Collection<? extends Callable<T>> tasks) <T> TinvokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) booleanboolean<U> CompletableFuture<U> static ExecutorServicenewThreadPoolExecutor(int maxAsync, int maxQueued) voidshutdown()Future<?> <T> Future<T> <T> Future<T> <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.ExecutorService
close
-
Constructor Details
-
SmallRyeManagedExecutor
public SmallRyeManagedExecutor(int maxAsync, int maxQueued, SmallRyeThreadContext threadContext, ExecutorService executor, String injectionPointName)
-
-
Method Details
-
newThreadPoolExecutor
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceExecutorService
-
shutdownNow
- Specified by:
shutdownNowin interfaceExecutorService
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceExecutorService
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceExecutorService
-
awaitTermination
- Specified by:
awaitTerminationin interfaceExecutorService- Throws:
InterruptedException
-
submit
- Specified by:
submitin interfaceExecutorService
-
submit
- Specified by:
submitin interfaceExecutorService
-
submit
- Specified by:
submitin interfaceExecutorService
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException - Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException - Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException - Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
execute
-
completedFuture
- Specified by:
completedFuturein interfaceorg.eclipse.microprofile.context.ManagedExecutor
-
completedStage
- Specified by:
completedStagein interfaceorg.eclipse.microprofile.context.ManagedExecutor
-
failedFuture
- Specified by:
failedFuturein interfaceorg.eclipse.microprofile.context.ManagedExecutor
-
failedStage
- Specified by:
failedStagein interfaceorg.eclipse.microprofile.context.ManagedExecutor
-
runAsync
- Specified by:
runAsyncin interfaceorg.eclipse.microprofile.context.ManagedExecutor
-
supplyAsync
- Specified by:
supplyAsyncin interfaceorg.eclipse.microprofile.context.ManagedExecutor
-
newIncompleteFuture
- Specified by:
newIncompleteFuturein interfaceorg.eclipse.microprofile.context.ManagedExecutor
-
toString
-
getThreadContextProviderPlan
-
getMaxAsync
public int getMaxAsync() -
getMaxQueued
public int getMaxQueued() -
getInjectionPointName
-
builder
-
copy
Returns a new
CompletableFuturethat is completed by the completion of the specified stage.The new completable future is backed by the ManagedExecutor upon which copy is invoked, which serves as the default asynchronous execution facility for the new stage and all dependent stages created from it, and so forth.
When dependent stages are created from the new completable future, thread context is captured and/or cleared by the ManagedExecutor. This guarantees that the action performed by each stage always runs under the thread context of the code that creates the stage, unless the user explicitly overrides by supplying a pre-contextualized action.
Invocation of this method does not impact thread context propagation for the supplied completable future or any dependent stages created from it, other than the new dependent completable future that is created by this method.
- Specified by:
copyin interfaceorg.eclipse.microprofile.context.ManagedExecutor- Type Parameters:
T- completable future result type.- Parameters:
stage- a completable future whose completion triggers completion of the new completable future that is created by this method.- Returns:
- the new completable future.
-
copy
Returns a new
CompletionStagethat is completed by the completion of the specified stage.The new completable future is backed by the ManagedExecutor upon which copy is invoked, which serves as the default asynchronous execution facility for the new stage and all dependent stages created from it, and so forth.
When dependent stages are created from the new completable future, thread context is captured and/or cleared by the ManagedExecutor. This guarantees that the action performed by each stage always runs under the thread context of the code that creates the stage, unless the user explicitly overrides by supplying a pre-contextualized action.
Invocation of this method does not impact thread context propagation for the supplied stage or any dependent stages created from it, other than the new dependent completion stage that is created by this method.
- Specified by:
copyin interfaceorg.eclipse.microprofile.context.ManagedExecutor- Type Parameters:
T- completion stage result type.- Parameters:
stage- a completion stage whose completion triggers completion of the new stage that is created by this method.- Returns:
- the new completion stage.
-
getThreadContext
Returns aThreadContextwhich has the same propagation settings as thisManagedExecutor, which uses thisManagedExecutoras its default executor.- Specified by:
getThreadContextin interfaceorg.eclipse.microprofile.context.ManagedExecutor- Returns:
- a ThreadContext with the same propagation settings as this ManagedExecutor.
-