ModeShape Distribution 3.0.0.Alpha6

org.modeshape.common.util
Class ThreadPools

java.lang.Object
  extended by org.modeshape.common.util.ThreadPools
All Implemented Interfaces:
ThreadPoolFactory

@ThreadSafe
public class ThreadPools
extends Object
implements ThreadPoolFactory

A simple ThreadPoolFactory implementation.


Nested Class Summary
protected static class ThreadPools.ThreadPoolHolder
           
 
Field Summary
static int DEFAULT_MAX_THREAD_COUNT
           
static String DEFAULT_THREAD_NAME
           
 
Constructor Summary
ThreadPools()
           
ThreadPools(int defaultMaxThreads, String threadFactoryName)
           
ThreadPools(int defaultMaxThreads, ThreadFactory threadFactory)
           
 
Method Summary
 Executor getThreadPool(String name)
          Obtain a thread pool with the supplied name, or create and return one if no thread pool exists with that name.
 void releaseThreadPool(Executor pool)
          Signal that the supplied thread pool is no longer needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_THREAD_NAME

public static final String DEFAULT_THREAD_NAME
See Also:
Constant Field Values

DEFAULT_MAX_THREAD_COUNT

public static final int DEFAULT_MAX_THREAD_COUNT
See Also:
Constant Field Values
Constructor Detail

ThreadPools

public ThreadPools()

ThreadPools

public ThreadPools(int defaultMaxThreads,
                   String threadFactoryName)

ThreadPools

public ThreadPools(int defaultMaxThreads,
                   ThreadFactory threadFactory)
Method Detail

getThreadPool

public Executor getThreadPool(String name)
Description copied from interface: ThreadPoolFactory
Obtain a thread pool with the supplied name, or create and return one if no thread pool exists with that name. When finished with the thread pool, it should be released.

Specified by:
getThreadPool in interface ThreadPoolFactory
Parameters:
name - the name of the thread pool; may not be null
Returns:
the thread pool executor; never null

releaseThreadPool

public void releaseThreadPool(Executor pool)
Description copied from interface: ThreadPoolFactory
Signal that the supplied thread pool is no longer needed.

Specified by:
releaseThreadPool in interface ThreadPoolFactory
Parameters:
pool - the pool that is no longer needed

ModeShape Distribution 3.0.0.Alpha6

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.