Class AffinityPool

  • All Implemented Interfaces:
    java.util.concurrent.Executor, java.util.concurrent.ExecutorService

    public class AffinityPool
    extends java.util.concurrent.AbstractExecutorService
    An ExecutorService implementation which pins actor to particular threads and guaranteed that an actor's Mailbox will e run on the thread it used it used to run. In situations where we see a lot of cache ping pong, this might lead to significant performance improvements.

    INTERNAL API

    • Constructor Summary

      Constructors 
      Constructor Description
      AffinityPool​(java.lang.String id, int parallelism, int affinityGroupSize, java.util.concurrent.ThreadFactory threadFactory, int idleCpuLevel, QueueSelector queueSelector, RejectionHandler rejectionHandler)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean awaitTermination​(long timeout, java.util.concurrent.TimeUnit unit)  
      void execute​(java.lang.Runnable command)  
      static int Initial()  
      static int Initializing()  
      static <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> x$1)  
      static <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> x$1, long x$2, java.util.concurrent.TimeUnit x$3)  
      static <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> x$1)  
      static <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> x$1, long x$2, java.util.concurrent.TimeUnit x$3)  
      boolean isShutdown()  
      boolean isTerminated()  
      protected static <T> java.util.concurrent.RunnableFuture<T> newTaskFor​(java.lang.Runnable x$1, T x$2)  
      protected static <T> java.util.concurrent.RunnableFuture<T> newTaskFor​(java.util.concurrent.Callable<T> x$1)  
      static int Parking()  
      QueueSelector queueSelector()  
      static int Running()  
      void shutdown()  
      static int ShutDown()  
      java.util.List<java.lang.Runnable> shutdownNow()  
      static int ShuttingDown()  
      static int Spinning()  
      AffinityPool start()  
      static java.util.concurrent.Future<?> submit​(java.lang.Runnable x$1)  
      static <T> java.util.concurrent.Future<T> submit​(java.lang.Runnable x$1, T x$2)  
      static <T> java.util.concurrent.Future<T> submit​(java.util.concurrent.Callable<T> x$1)  
      static int Terminated()  
      java.lang.String toString()  
      static int Uninitialized()  
      static int Yielding()  
      • Methods inherited from class java.util.concurrent.AbstractExecutorService

        invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
      • Methods inherited from class java.lang.Object

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

      • AffinityPool

        public AffinityPool​(java.lang.String id,
                            int parallelism,
                            int affinityGroupSize,
                            java.util.concurrent.ThreadFactory threadFactory,
                            int idleCpuLevel,
                            QueueSelector queueSelector,
                            RejectionHandler rejectionHandler)
    • Method Detail

      • Uninitialized

        public static final int Uninitialized()
      • Initializing

        public static final int Initializing()
      • Running

        public static final int Running()
      • ShuttingDown

        public static final int ShuttingDown()
      • ShutDown

        public static final int ShutDown()
      • Terminated

        public static final int Terminated()
      • Initial

        public static final int Initial()
      • Spinning

        public static final int Spinning()
      • Yielding

        public static final int Yielding()
      • Parking

        public static final int Parking()
      • newTaskFor

        protected static <T> java.util.concurrent.RunnableFuture<T> newTaskFor​(java.lang.Runnable x$1,
                                                                               T x$2)
      • newTaskFor

        protected static <T> java.util.concurrent.RunnableFuture<T> newTaskFor​(java.util.concurrent.Callable<T> x$1)
      • submit

        public static java.util.concurrent.Future<?> submit​(java.lang.Runnable x$1)
      • submit

        public static <T> java.util.concurrent.Future<T> submit​(java.lang.Runnable x$1,
                                                                T x$2)
      • submit

        public static <T> java.util.concurrent.Future<T> submit​(java.util.concurrent.Callable<T> x$1)
      • invokeAny

        public static <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> x$1)
                               throws java.util.concurrent.ExecutionException,
                                      java.lang.InterruptedException
        Throws:
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • invokeAny

        public static <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> x$1,
                                      long x$2,
                                      java.util.concurrent.TimeUnit x$3)
                               throws java.util.concurrent.TimeoutException,
                                      java.util.concurrent.ExecutionException,
                                      java.lang.InterruptedException
        Throws:
        java.util.concurrent.TimeoutException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • invokeAll

        public static <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> x$1)
                                                                            throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • invokeAll

        public static <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> x$1,
                                                                                   long x$2,
                                                                                   java.util.concurrent.TimeUnit x$3)
                                                                            throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • execute

        public void execute​(java.lang.Runnable command)
      • awaitTermination

        public boolean awaitTermination​(long timeout,
                                        java.util.concurrent.TimeUnit unit)
      • shutdownNow

        public java.util.List<java.lang.Runnable> shutdownNow()
      • shutdown

        public void shutdown()
      • isShutdown

        public boolean isShutdown()
      • isTerminated

        public boolean isTerminated()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object