List of utility methods to do Thread Executor Create
ThreadFactory | createDaemonThreadFactory() Creates a ThreadFactory which produces threads which run as daemons. return createDaemonThreadFactory(null);
|
ThreadPoolExecutor | createDefaultExecutorService() Returns a new thread pool configured with the default settings. ThreadFactory threadFactory = new ThreadFactory() { private int threadCount = 1; public Thread newThread(Runnable r) { Thread thread = new Thread(r); thread.setName("s3-transfer-manager-worker-" + threadCount++); return thread; }; ... |
ThreadPoolExecutor | createDefaultExecutorService(final String threadNamePrefix, final int parallel) Returns a new thread pool configured with the default settings. ThreadFactory threadFactory = new ThreadFactory() { private int threadCount = 1; public Thread newThread(Runnable r) { Thread thread = new Thread(r); thread.setName(threadNamePrefix + threadCount++); return thread; }; ... |
ExecutorService | createEventsOrderedDeliveryExecutor() create Events Ordered Delivery Executor return Executors.newSingleThreadExecutor(new ThreadFactory() { private AtomicInteger cnt = new AtomicInteger(0); @Override public Thread newThread(Runnable r) { Thread t = new Thread(r, "Ordered Events Thread-" + cnt.incrementAndGet()); t.setDaemon(true); return t; }); |
ScheduledExecutorService | createExecutor() create Executor return Executors.newSingleThreadScheduledExecutor(daemonThreadFactory());
|
ExecutorService | createExecutor(final String file) create Executor return Executors.newSingleThreadExecutor(new ThreadFactory() { public Thread newThread(Runnable r) { return new Thread(r, "Export thread for " + file); }); |
ExecutorService | createExecutors(int numThreads) create Executors return Executors.newFixedThreadPool(numThreads, new ThreadFactory() { public Thread newThread(Runnable r) { Thread thread = new Thread(r); thread.setName(r.getClass().getName()); return thread; }); |
ThreadPoolExecutor | createExecutorService() create Executor Service return new ThreadPoolExecutor(1, 1, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); |
ScheduledExecutorService | createResourceRetrievalService(final String threadName) Convenience method to create a java.util.concurrent.ScheduledExecutorService which can be used by World Wind components to schedule periodic resource checks. ThreadFactory threadFactory = new ThreadFactory() { public Thread newThread(Runnable r) { Thread thread = new Thread(r); thread.setDaemon(true); thread.setPriority(Thread.MIN_PRIORITY); if (threadName != null) { thread.setName(threadName); return thread; }; return Executors.newSingleThreadScheduledExecutor(threadFactory); |
ExecutorService | createSingleThreadExecutor(final String name) create Single Thread Executor return Executors.newSingleThreadExecutor(createSimpleThreadFactory(name));
|