Package org.jenkinsci.remoting.util
Class ExecutorServiceUtils
- java.lang.Object
-
- org.jenkinsci.remoting.util.ExecutorServiceUtils
-
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class ExecutorServiceUtils extends Object
Helper class forExecutorService
operations.- Author:
- Oleg Nenashev
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExecutorServiceUtils.ExecutionRejectedException
Wraps the runtimeRejectedExecutionException
.static class
ExecutorServiceUtils.FatalRejectedExecutionException
Version ofRejectedExecutionException
, which treats the error as fatal.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RejectedExecutionException
createRuntimeException(String message, ExecutorServiceUtils.ExecutionRejectedException cause)
Creates a runtimeRejectedExecutionException
forExecutorServiceUtils.ExecutionRejectedException
.static void
submitAsync(ExecutorService es, Runnable runnable)
Submits a task to the executor service without further handling.
-
-
-
Method Detail
-
submitAsync
public static void submitAsync(@NonNull ExecutorService es, @NonNull Runnable runnable) throws ExecutorServiceUtils.ExecutionRejectedException
Submits a task to the executor service without further handling. The originalExecutorService.submit(java.lang.Runnable)
method actually expects this return value to be handled, but this method explicitly relies on the external logic to handle the future operation. Use on your own risk.- Parameters:
es
- Executor servicerunnable
- Operation to be executed- Throws:
ExecutorServiceUtils.ExecutionRejectedException
- Execution is rejected by the executor service
-
createRuntimeException
@NonNull public static RejectedExecutionException createRuntimeException(@NonNull String message, @NonNull ExecutorServiceUtils.ExecutionRejectedException cause)
Creates a runtimeRejectedExecutionException
forExecutorServiceUtils.ExecutionRejectedException
. This version takes theExecutorServiceUtils.ExecutionRejectedException.isFatal()
value into account and createsExecutorServiceUtils.FatalRejectedExecutionException
if required.- Parameters:
message
- Messagecause
- Base non-Runtime exception- Returns:
- Created Runtime exception
-
-