Class AffinityPool

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

    public class AffinityPool
    extends java.util.concurrent.AbstractExecutorService
    Each worker should go through that method while terminating. In turn each worker is responsible for modifying the pool state accordingly. For example if this is the last worker and the queue is empty and we are in a ShuttingDown state the worker can transition the pool to ShutDown and attempt termination

    Furthermore, if this worker has experienced abrupt termination due to an exception being thrown in user code, the worker is responsible for adding one more worker to compensate for its own termination

    • 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()
      • 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()
        toString in class java.lang.Object