avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: ThreadPool
Date Fri, 04 May 2001 07:05:02 GMT
At 11:33  3/5/01 -0700, cmanolache@yahoo.com wrote:
>On Fri, 4 May 2001, Peter Donald wrote:
>
>> At 12:29  3/5/01 -0700, Earl Hood wrote:
>> >On May 3, 2001 at 12:46, "Michael Gerdau" wrote:
>> 
>> Unfortunately that doesn't cut it as usually you need to have Thread
>> implement a particular class so it replaces itself back in pool after it
>> has done a run() on it' client. The way I am just about to redesign the
>> Avalon thread pool is as follows
>> 
>> interface ThreadPool
>> {
>>   void executeAndWait( Runnable work ) throws ThreadException;
>>   void executeAndWait( Executable work ) throws ThreadException;
>> 
>>   ThreadControl execute( Runnable work );
>>   ThreadControl execute( Executable work );
>> }
>
>I was thinking of something simpler:
>
>interface SimpleThreadPool {
>   void run( Runnable r );
>}
>
>That's all you need in most cases.

true - but when you hit one of the "other" cases you have to throw away the
pool or do some massive workarounds. Check out the hacks in Avalon that
were used to get around the above.

>On top of this you can add other (optional) APIs ( like ThreadPoolRunnable
>in tomcat, that saves a hashtable lookup, or any other fancy methods
>). And of course, the implementation migh have some setters and getters to
>configure the pool and get info - but that's specific to each
>implementation.
>
>
>IMHO a big problem with java is that it's far too easy to create
>interfaces.

Well I believe the opposite ;) - it is far too easy to not use interfaces -
hence the scattered interdependencies on most products.

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Mime
View raw message