org.hibernate.search.batchindexing
Class Executors

java.lang.Object
  extended by org.hibernate.search.batchindexing.Executors

public class Executors
extends java.lang.Object

Helper class to create threads; these threads are grouped and named to be identified in a profiler.

Author:
Sanne Grinovero

Constructor Summary
Executors()
           
 
Method Summary
static java.util.concurrent.ThreadPoolExecutor newFixedThreadPool(int threads, java.lang.String groupname)
          Creates a new fixed size ThreadPoolExecutor.
static java.util.concurrent.ThreadPoolExecutor newFixedThreadPool(int threads, java.lang.String groupname, int queueSize)
          Creates a new fixed size ThreadPoolExecutor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Executors

public Executors()
Method Detail

newFixedThreadPool

public static java.util.concurrent.ThreadPoolExecutor newFixedThreadPool(int threads,
                                                                         java.lang.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 threads
groupname - a label to identify the threadpool; useful for profiling.
Returns:
the new ExecutorService

newFixedThreadPool

public static java.util.concurrent.ThreadPoolExecutor newFixedThreadPool(int threads,
                                                                         java.lang.String groupname,
                                                                         int queueSize)
Creates a new fixed size ThreadPoolExecutor

Parameters:
threads - the number of threads
groupname - 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-2010 Hibernate. All Rights Reserved.