Class PriorityExecutorService
java.lang.Object
org.axonframework.axonserver.connector.util.PriorityExecutorService
- All Implemented Interfaces:
AutoCloseable,Executor,ExecutorService
This
ExecutorService wraps an existing one, creating a PriorityTask for every Runnable that
is submitted that's an instance of one. The created PriorityTask will have the priority provided in the
constructor, as well as the taskSequence provided there.
This implementation also diverts all invocations of ExecutorService.submit(Runnable) to
Executor.execute(Runnable) instead. This is because the submit method implementations wrap the
tasks in another FutureTask, which makes the task uncomparable again.
- Since:
- 4.6.0
- Author:
- Mitchell Herrijgers, Milan Savic
-
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long timeout, TimeUnit unit) voidinvokeAll(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) booleanbooleanvoidshutdown()Future<?> <T> Future<T> <T> Future<T> Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.ExecutorService
close
-
Method Details
-
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
@Nonnull public <T> List<Future<T>> invokeAll(@Nonnull Collection<? extends Callable<T>> tasks) throws InterruptedException - Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
invokeAll
@Nonnull public <T> List<Future<T>> invokeAll(@Nonnull Collection<? extends Callable<T>> tasks, long timeout, @Nonnull TimeUnit unit) throws InterruptedException - Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
invokeAny
@Nonnull public <T> T invokeAny(@Nonnull Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException - Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionException
-
invokeAny
public <T> T invokeAny(@Nonnull Collection<? extends Callable<T>> tasks, long timeout, @Nonnull TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
execute
-