Interface ArtemisExecutor
-
- All Superinterfaces:
java.util.concurrent.Executor
- All Known Implementing Classes:
OrderedExecutor
public interface ArtemisExecutor extends java.util.concurrent.Executor
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static ArtemisExecutordelegate(java.util.concurrent.Executor executor)Artemis is supposed to implement this properly, however in tests or tools this can be used as a fake, doing a simple delegate and using the default methods implemented here.default booleanflush(long timeout, java.util.concurrent.TimeUnit unit)To be used to flush an executor from a different thread.default booleanisFlushed()This will verify if the executor is flushed with no wait (or very minimal wait if not theOrderedExecutordefault voidshutdown()default intshutdownNow()It will wait the current execution (if there is one) to finish but will not complete any further executionsdefault intshutdownNow(java.util.function.Consumer<? super java.lang.Runnable> onPendingTask, int timeout, java.util.concurrent.TimeUnit unit)It will wait the current execution (if there is one) to finish but will not complete any further executions.
-
-
-
Method Detail
-
delegate
static ArtemisExecutor delegate(java.util.concurrent.Executor executor)
Artemis is supposed to implement this properly, however in tests or tools this can be used as a fake, doing a simple delegate and using the default methods implemented here.- Parameters:
executor-- Returns:
-
shutdownNow
default int shutdownNow(java.util.function.Consumer<? super java.lang.Runnable> onPendingTask, int timeout, java.util.concurrent.TimeUnit unit)It will wait the current execution (if there is one) to finish but will not complete any further executions.- Parameters:
onPendingTask- it will be called for each pending task found- Returns:
- the number of pending tasks that won't be executed
-
flush
default boolean flush(long timeout, java.util.concurrent.TimeUnit unit)To be used to flush an executor from a different thread. WARNING: Do not call this within the executor. That would be stoopid ;)- Parameters:
timeout-unit-- Returns:
-
shutdownNow
default int shutdownNow()
It will wait the current execution (if there is one) to finish but will not complete any further executions
-
shutdown
default void shutdown()
-
isFlushed
default boolean isFlushed()
This will verify if the executor is flushed with no wait (or very minimal wait if not theOrderedExecutor- Returns:
-
-