org.hibernate.search.batchindexing.impl
Class Executors
java.lang.Object
org.hibernate.search.batchindexing.impl.Executors
public class Executors
- extends Object
Helper class to create threads;
these threads are grouped and named to be identified in a profiler.
- Author:
- Sanne Grinovero
Nested Class Summary |
static class |
Executors.BlockPolicy
A handler for rejected tasks that will have the caller block until
space is available. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QUEUE_MAX_LENGTH
public static final int QUEUE_MAX_LENGTH
- See Also:
- Constant Field Values
Executors
public Executors()
newFixedThreadPool
public static ThreadPoolExecutor newFixedThreadPool(int threads,
String groupname)
- Creates a new fixed size ThreadPoolExecutor.
It's using a blockingqueue of maximum 1000 elements and the rejection
policy is set to CallerRunsPolicy for the case the queue is full.
These settings are required to cap the queue, to make sure the
timeouts are reasonable for most jobs.
- Parameters:
threads
- the number of threadsgroupname
- a label to identify the threadpool; useful for profiling.
- Returns:
- the new ExecutorService
newFixedThreadPool
public static ThreadPoolExecutor newFixedThreadPool(int threads,
String groupname,
int queueSize)
- Creates a new fixed size ThreadPoolExecutor
- Parameters:
threads
- the number of threadsgroupname
- a label to identify the threadpool; useful for profiling.queueSize
- the size of the queue to store Runnables when all threads are busy
- Returns:
- the new ExecutorService
Copyright © 2006-2012 Red Hat Middleware, LLC. All Rights Reserved