Interface ArtemisExecutor

    • Method Summary

      All Methods Static Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      static ArtemisExecutor delegate​(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 boolean flush​(long timeout, TimeUnit unit)
      To be used to flush an executor from a different thread.
      default boolean isFair()  
      default boolean isFlushed()
      This will verify if the executor is flushed with no wait (or very minimal wait if not the OrderedExecutor
      default ArtemisExecutor setFair​(boolean fair)
      If this OrderedExecutor is fair, it will yield for another executors after each task ran
      default void shutdown()  
      default int shutdownNow()
      It will wait the current execution (if there is one) to finish but will not complete any further executions
      default int shutdownNow​(Consumer<? super Runnable> onPendingTask, int timeout, TimeUnit unit)
      It will wait the current execution (if there is one) to finish but will not complete any further executions.
      default void yield()
      It will give up the executor loop, giving a chance to other OrderedExecutors to run
    • Method Detail

      • delegate

        static ArtemisExecutor delegate​(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​(Consumer<? super Runnable> onPendingTask,
                                int timeout,
                                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,
                              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()
      • yield

        default void yield()
        It will give up the executor loop, giving a chance to other OrderedExecutors to run
      • isFair

        default boolean isFair()
      • setFair

        default ArtemisExecutor setFair​(boolean fair)
        If this OrderedExecutor is fair, it will yield for another executors after each task ran
      • isFlushed

        default boolean isFlushed()
        This will verify if the executor is flushed with no wait (or very minimal wait if not the OrderedExecutor
        Returns: