org.objectledge.threads
Class ThreadPool

java.lang.Object
  extended by org.objectledge.threads.ThreadPool
All Implemented Interfaces:
org.picocontainer.Startable

public class ThreadPool
extends Object
implements org.picocontainer.Startable

Thread pool component.

Version:
$Id: ThreadPool.java,v 1.11 2006/02/08 18:24:45 zwierzem Exp $
Author:
Rafal Krzewski

Field Summary
private  Valve cleanup
          cleanup valve (possibly pipeline).
private  Context context
          thread's processing context.
private  int daemonPriority
           
private  org.jcontainer.dna.Logger log
           
private static String THREAD_GROUP_NAME
           
private  ThreadGroup threadGroup
          thread pool's thread group.
private  Set<Daemon> threads
           
private  WorkerPool workerPool
           
private  int workerPoolCapacity
           
private  int workerPriority
           
 
Constructor Summary
ThreadPool(Valve cleanup, Context context, org.jcontainer.dna.Configuration config, org.jcontainer.dna.Logger log)
          Component constructor.
 
Method Summary
 void runDaemon(Task task)
          Run the daemon task.
 void runWorker(Task task)
          Run the worker task.
 void start()
          
 void stop()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THREAD_GROUP_NAME

private static final String THREAD_GROUP_NAME
See Also:
Constant Field Values

context

private Context context
thread's processing context.


cleanup

private Valve cleanup
cleanup valve (possibly pipeline).


threadGroup

private ThreadGroup threadGroup
thread pool's thread group.


daemonPriority

private int daemonPriority

workerPriority

private int workerPriority

workerPoolCapacity

private int workerPoolCapacity

threads

private Set<Daemon> threads

log

private org.jcontainer.dna.Logger log

workerPool

private WorkerPool workerPool
Constructor Detail

ThreadPool

public ThreadPool(Valve cleanup,
                  Context context,
                  org.jcontainer.dna.Configuration config,
                  org.jcontainer.dna.Logger log)
Component constructor.

Parameters:
cleanup - the valve that should be invoked every time the thread finishes it's work.
context - thread processing context.
config - the pool configuration.
log - the logger to use.
Method Detail

runWorker

public void runWorker(Task task)
Run the worker task.

Parameters:
task - the task to run.

runDaemon

public void runDaemon(Task task)
Run the daemon task.

Parameters:
task - the task to run.

start

public void start()

Specified by:
start in interface org.picocontainer.Startable

stop

public void stop()

Specified by:
stop in interface org.picocontainer.Startable


Copyright © 2003-2006 objectledge.org. All Rights Reserved.