Java Thread Executor Create getExecutor()

Here you can find the source of getExecutor()

Description

Gets an existing cached thread pool or creates new one if none exists

License

Open Source License

Declaration

public static ExecutorService getExecutor() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Main {
    private static ExecutorService executor;

    /**/*from w ww .j a v a 2 s. c o  m*/
     * Gets an existing cached thread pool or creates new one if none exists
     *
     * @return
     */
    public static ExecutorService getExecutor() {
        if (executor == null) {
            executor = Executors.newCachedThreadPool();
        }
        return executor;
    }
}

Related

  1. createExecutorService()
  2. createResourceRetrievalService( final String threadName)
  3. createSingleThreadExecutor(final String name)
  4. createStatisticsExecutor()
  5. createThreadFactory(final String prefix)
  6. getExecutor(int numTasks, int maxThreads)
  7. getExecutorService()
  8. getExecutorService()
  9. getExecutorService()