Interface AMExecutorServiceFactory

    • Method Detail

      • createScheduledService

        ScheduledExecutorService createScheduledService​(int poolSize,
                                                        String threadNamePrefix)
        Generates a ScheduledExecutorService which has been pre-registered with the ShutdownManager.
        Parameters:
        poolSize - The size of the ScheduledExecutorService thread pool.
        threadNamePrefix - The thread name prefix to use when generating new threads.
        Returns:
        A non null ScheduledExecutorService
        See Also:
        Executors.newScheduledThreadPool(int)
      • createFixedThreadPool

        ExecutorService createFixedThreadPool​(int pool,
                                              ThreadFactory factory)
        Creates a fixed size Thread Pool ExecutorService which has been pre-registered with the ShutdownManager.
        Parameters:
        pool - The size of the pool to create.
        factory - The ThreadFactory used to generate new threads.
        Returns:
        Non null.
      • createFixedThreadPool

        ExecutorService createFixedThreadPool​(int pool,
                                              String threadNamePrefix)
        Create a fixed size Thread Pool ExecutorService using the provided name as the prefix of the thread names.
        Parameters:
        pool - Size of the fixed pool.
        threadNamePrefix - The thread name prefix to use when generating new threads.
        Returns:
        Non null.
        See Also:
        createFixedThreadPool(int, java.util.concurrent.ThreadFactory)
      • createCachedThreadPool

        ExecutorService createCachedThreadPool​(ThreadFactory factory)
        Generates a Cached Thread Pool ExecutorService which has been pre-registered with the ShutdownManager. The provided ThreadFactory is used by the service when creating Threads.
        Parameters:
        factory - The ThreadFactory that will be used when generating threads. May not be null.
        Returns:
        A non null ExecutorService.
        See Also:
        Executors.newCachedThreadPool(java.util.concurrent.ThreadFactory)
      • createThreadPool

        ExecutorService createThreadPool​(int coreSize,
                                         int maxSize,
                                         long idleTimeout,
                                         TimeUnit timeoutTimeunit,
                                         BlockingQueue<Runnable> runnables,
                                         String threadNamePrefix)
        Generates a ThreadPoolExecutor with the provided values, and registers that executor as listening for shutdown messages.
        Parameters:
        coreSize - the number of threads to keep in the pool, even if they are idle
        maxSize - Max number of threads in the pool
        idleTimeout - When the number of threads is greater than core, maximum time that excess idle threads will wait before terminating
        timeoutTimeunit - The time unit for the idleTimeout argument
        runnables - Queue of threads to be run
        threadNamePrefix - The thread name prefix to use when generating new threads.
        Returns:
        a configured ExecutorService, registered to listen to shutdown messages.