I have been working on a ResourceLimitingThreadPool which will hard
limit the number of Worker Threads that can be created by the pool. In
order to get that working without any code duplication, I had to make
the following changes to the WorkerThread class. The change simply makes
the WorkerThread accept a Pool rather than a SoftResourceLimitingPool,
making it more flexible.

Also, I am planning to submit this new class when it is done, so I am
developing it in the same package. But if others wanted to use this
class, they would not be able to because neither the class or its
constructor are public.

cvs -z3 diff WorkerThread.java (in directory
E:\Jakarta\jakarta-avalon-excalibur\src\scratchpad\org\apache\avalon\excalibur\thread\impl\)
Index: WorkerThread.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/thread/impl/WorkerThread.java,v
retrieving revision 1.5
diff -r1.5 WorkerThread.java
12c12
< import org.apache.avalon.excalibur.pool.SoftResourceLimitingPool;
---
> import org.apache.avalon.excalibur.pool.Pool;
30c30
< private SoftResourceLimitingPool m_pool;
---
> private Pool m_pool;
42c42
< final SoftResourceLimitingPool pool,
---
> final Pool pool,

Also, as is, the DefaultThreadPool should also implement Disposable
because the WorkerThreads in the pool need to have a way of being
disposed of when the pool is no longer needed.

cvs -z3 diff DefaultThreadPool.java (in directory
E:\Jakarta\jakarta-avalon-excalibur\src\scratchpad\org\apache\avalon\excalibur\thread\impl\)
Index: DefaultThreadPool.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/thread/impl/DefaultThreadPool.java,v
retrieving revision 1.9
diff -r1.9 DefaultThreadPool.java
15a16
> import org.apache.avalon.framework.activity.Disposable;
32c33
< implements ObjectFactory, Loggable, LogEnabled, ThreadPool
---
> implements ObjectFactory, Loggable, LogEnabled, Disposable, ThreadPool
34c35
< private final SoftResourceLimitingPool m_pool;
---
> private SoftResourceLimitingPool m_pool;
93a95,100
> public void dispose()
> {
> m_pool.dispose();
> m_pool = null;
> }
>

Cheers,
Leif



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to