Main Page   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members  

PoolExecutor Class Template Reference

#include <PoolExecutor.h>

Inheritance diagram for PoolExecutor:

Executor Cancelable Waitable NonCopyable List of all members.

Public Methods

 PoolExecutor (unsigned int min) throw (Synchronization_Exception)
 PoolExecutor (unsigned int min, unsigned int max) throw (Synchronization_Exception)
void setMax (unsigned int max) throw (Synchronization_Exception)
void setMin (unsigned int) throw (Synchronization_Exception)
unsigned int getMax () throw (Synchronization_Exception)
unsigned int getMin () throw (Synchronization_Exception)
virtual ~PoolExecutor () throw ()
 Destroy a new PoolExecutor.

virtual void execute (const RunnableHandle &task) throw (Synchronization_Exception)
void execute (Runnable *task) throw (Synchronization_Exception)
virtual void cancel () throw (Synchronization_Exception)
virtual bool isCanceled () throw (Synchronization_Exception)
virtual void wait () throw (Synchronization_Exception)
virtual bool wait (unsigned long timeout) throw (Synchronization_Exception)

Detailed Description

template<class LockType, class FactoryType = DefaultThreadFactory, class QueueType = MonitoredQueue<RunnableHandle*, LockType>, typename RefType = CountedPtr<QueueType>>
class ZThread::PoolExecutor< LockType, FactoryType, QueueType, RefType >

Author:
Eric Crahen <crahen@cse.buffalo.edu>
Date:
<2002-06-10T09:16:16-0400>
Version:
2.2.2
This is an Executor that will run submitted tasks using a group of threads.

See also:
Executor


Constructor & Destructor Documentation

PoolExecutor unsigned int    min throw (Synchronization_Exception) [inline]
 

Create a new PoolExecutor

Parameters:
min  - minimum number of threads to service tasks with

PoolExecutor unsigned int    min,
unsigned int    max
throw (Synchronization_Exception) [inline]
 

Create a new PoolExecutor

Parameters:
min  - minimum number of threads to service tasks with
max  - maximum number of threads to service tasks with


Member Function Documentation

virtual void cancel   throw (Synchronization_Exception) [inline, virtual]
 

See also:
Executor::cancel()

Implements Executor.

void execute Runnable   task throw (Synchronization_Exception) [inline]
 

Convience method

See also:
Executor::execute(const RunnableHandle&)

virtual void execute const RunnableHandle &    task throw (Synchronization_Exception) [inline, virtual]
 

Submit a light wieght task to an Executor. This will not block the calling thread very long. The submitted task will be executed at some later point by another thread.

Exceptions:
Cancellation_Exception  thrown if a task is submited when the executor has been canceled.
Synchronization_Exception  thrown is some other error occurs.
See also:
Executor::execute(RunnableHandle&)

Implements Executor.

unsigned int getMax   throw (Synchronization_Exception) [inline]
 

Get the current maximum number of threads

Returns:
unsigned int - current maximum
Exceptions:
Interrupted_Exception 

unsigned int getMin   throw (Synchronization_Exception) [inline]
 

Get the current minimum number of threads

Returns:
unsigned int - current minimum
Exceptions:
Interrupted_Exception 

virtual bool isCanceled   throw (Synchronization_Exception) [inline, virtual]
 

See also:
Executor::isCanceled()

Implements Cancelable.

void setMax unsigned int    max throw (Synchronization_Exception) [inline]
 

Change the maximum number of threads in the pool. As tasks are added to the Executor, more threads will be added as needed - up to the maximum number of worker threads set.

Parameters:
unsigned  int - new maximum number of worker threads.
Exceptions:
Interrupted_Exception 

void setMin unsigned    int throw (Synchronization_Exception) [inline]
 

Change the minimum number of threads in the pool. When currently running tasks complete, and the Thread executing the task completes it can be removed. A Thread will never be instantly canceled because the minimum number of threads has changed. It is a gradual decline in the number of worker threads, they are canceled lazily.

Parameters:
unsigned  int - new minimum number of worker threads.
Exceptions:
Interrupted_Exception 

virtual bool wait unsigned long    timeout throw (Synchronization_Exception) [inline, virtual]
 

See also:
Executor::wait(unsigned long)

Implements Executor.

virtual void wait   throw (Synchronization_Exception) [inline, virtual]
 

See also:
Executor::wait()

Implements Executor.


The documentation for this class was generated from the following file:
Generated on Mon Jun 10 22:44:45 2002 for ZThread by doxygen1.2.15