Class OrderedExecutor


  • public class OrderedExecutor
    extends java.lang.Object
    Wrapper for executor services which ensures that tasks with the same key are processed in order.
    • Constructor Summary

      Constructors 
      Constructor Description
      OrderedExecutor​(java.util.concurrent.ExecutorService delegateService)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.concurrent.Future<java.lang.Void> submit​(java.lang.Object orderingKey, java.lang.Runnable runnable)  
      <T> java.util.concurrent.Future<T> submit​(java.lang.Object orderingKey, java.util.concurrent.Callable<T> callable)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OrderedExecutor

        public OrderedExecutor​(java.util.concurrent.ExecutorService delegateService)
        Parameters:
        delegateService - Executor service where to delegate the actual execution to
    • Method Detail

      • submit

        public java.util.concurrent.Future<java.lang.Void> submit​(java.lang.Object orderingKey,
                                                                  java.lang.Runnable runnable)
        Parameters:
        orderingKey - Key for the ordering channel
        runnable - Runnable to submit to the executor service
        Returns:
        Future for the task
      • submit

        public <T> java.util.concurrent.Future<T> submit​(java.lang.Object orderingKey,
                                                         java.util.concurrent.Callable<T> callable)
        Parameters:
        orderingKey - Key for the ordering channel
        callable - Callable to submit to the executor service
        Returns:
        Future for the task