|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.bea.domingo.threadpool.SimpleThreadPool
public final class SimpleThreadPool
A simple implementation of a ThreadPool which is constructed with a given number of threads.
Field Summary | |
---|---|
static int |
DEFAULT_NUM_THREAD
Default number of threads in the thread pool. |
static int |
MAX_WAIT_FOR_STOP
Maximum amount of time to wait for a thread to stop. |
static int |
MAX_WAIT_FOR_TASK
Maximum amount of time to wait for a task from the queue in milli seconds. |
Constructor Summary | |
---|---|
SimpleThreadPool()
Constructor. |
|
SimpleThreadPool(DNotesMonitor monitor)
Constructor. |
|
SimpleThreadPool(DNotesMonitor monitor,
int numberOfThreads)
Constructor. |
|
SimpleThreadPool(DNotesMonitor monitor,
int numberOfThreads,
int threadPriority)
Constructor. |
|
SimpleThreadPool(DNotesMonitor monitor,
ThreadFactory threadFactory,
int numberOfThreads)
Constructor. |
|
SimpleThreadPool(DNotesMonitor theMonitor,
ThreadFactory theThreadFactory,
int theNumberOfThreads,
int theThreadPriority)
Constructor. |
|
SimpleThreadPool(int numberOfThreads)
Constructor. |
|
SimpleThreadPool(int numberOfThreads,
int threadPriority)
Constructor. |
Method Summary | |
---|---|
int |
getRunnableCount()
Returns number of runnable objects in the queue. |
void |
invokeLater(java.lang.Runnable task)
Dispatch a new task onto this pool to be invoked asynchronously later. |
void |
resize(int newSize)
Resize the thread pool. |
void |
run()
The method ran by the pool of background threads. |
void |
stop()
Stops the pool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_WAIT_FOR_TASK
public static final int MAX_WAIT_FOR_STOP
public static final int DEFAULT_NUM_THREAD
Constructor Detail |
---|
public SimpleThreadPool() throws ThreadPoolException
ThreadPoolException
- if any error occurs during starting threadspublic SimpleThreadPool(DNotesMonitor monitor) throws ThreadPoolException
monitor
- the monitor
ThreadPoolException
- if any error occurs during starting threadspublic SimpleThreadPool(int numberOfThreads) throws ThreadPoolException
numberOfThreads
- number of threads in pool
ThreadPoolException
- if any error occurs during starting threadspublic SimpleThreadPool(DNotesMonitor monitor, int numberOfThreads) throws ThreadPoolException
monitor
- ThreadPool MonitornumberOfThreads
- number of threads in pool
ThreadPoolException
- if any error occurs during starting threads
ThreadPoolException
- if any error occurs during starting threadspublic SimpleThreadPool(int numberOfThreads, int threadPriority) throws ThreadPoolException
numberOfThreads
- number of threads in poolthreadPriority
- priority of threads in pool
ThreadPoolException
- if any error occurs during starting threadspublic SimpleThreadPool(DNotesMonitor monitor, int numberOfThreads, int threadPriority) throws ThreadPoolException
monitor
- ThreadPool MonitornumberOfThreads
- number of threads in poolthreadPriority
- priority of threads in pool
ThreadPoolException
- if any error occurs during starting threadspublic SimpleThreadPool(DNotesMonitor monitor, ThreadFactory threadFactory, int numberOfThreads) throws ThreadPoolException
monitor
- ThreadPool MonitorthreadFactory
- ThreadFactory to us to create the new ThreadsnumberOfThreads
- number of threads in pool
ThreadPoolException
- if any error occurs during starting threadspublic SimpleThreadPool(DNotesMonitor theMonitor, ThreadFactory theThreadFactory, int theNumberOfThreads, int theThreadPriority) throws ThreadPoolException
theMonitor
- ThreadPool monitortheThreadFactory
- ThreadFactory to us to create the new ThreadstheNumberOfThreads
- number of threads in pooltheThreadPriority
- priority of threads in pool
ThreadPoolException
- if any error occurs during starting threadsMethod Detail |
---|
public int getRunnableCount()
public void invokeLater(java.lang.Runnable task)
invokeLater
in interface ThreadPool
task
- the task to executepublic void stop()
ThreadPool
stop
in interface ThreadPool
ThreadPool.stop()
public void resize(int newSize) throws ThreadPoolException
resize
in interface ThreadPool
newSize
- new number of threads in the thread pool
ThreadPoolException
- if any error occurs during starting threadsThreadPool.resize(int)
public void run()
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |