You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Emperor <Da...@gmx.net> on 2002/02/26 16:46:20 UTC

create threads? or use thread manager...

Hi,

My manager block needs long living threads (two or three, in this case),
should I create java.lang.Thread instances or retrieve them using the
ThreadManager.getDefaultPool().execute() method, or should I create a
thread pool?

Thx,

Nils


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: AW: create threads? or use thread manager...

Posted by Berin Loritsch <bl...@apache.org>.
Emperor wrote:
> 
>>-----Ursprüngliche Nachricht-----
>>Von: Berin Loritsch [mailto:bloritsch@apache.org] 
>>Gesendet: Dienstag, 26. Februar 2002 21:24
>>An: Avalon Developers List
>>Betreff: Re: create threads? or use thread manager...
>>
>>
>>Peter Donald wrote:
>>
>>>On Wed, 27 Feb 2002 07:05, Berin Loritsch wrote:
>>>
>>>
>>>>Peter Donald wrote:
>>>>
>>>>
>>>>>On Wed, 27 Feb 2002 02:46, Emperor wrote:
>>>>>
>>>>>
>>>>>>My manager block needs long living threads (two or three, in this 
>>>>>>case), should I create java.lang.Thread instances or 
>>>>>>
>>retrieve them 
>>
>>>>>>using the
>>>>>>ThreadManager.getDefaultPool().execute() method, or 
>>>>>>
>>should I create a
>>
>>>>>>thread pool?
>>>>>>
>>>>>>
>>>>>Up to you. I think I would create them manually if you are only 
>>>>>creating2-3
>>>>>
>>>>>
>>>>Also keep in mind that ThreadManagers allow you to change 
>>>>
>>the policy 
>>
>>>>of thread pools easily.  For instance, if you want 2 threads per 
>>>>processor, the ThreadManager has something that 
>>>>
>>automatically figures 
>>
>>>>that out (using SystemUtil of course).
>>>>
>>>>
>>>Which ThreadManager are you talking about?
>>>
>>
>>The one in excalibur.command.ThreadManager
>>
>>
> 
> Nope... I was walking about the
> cornerstone/services/threads/ThreadManager
> 
> Is it deprecated? Should I use the excalibur one?

No it is not deprecated.  The one in Excalibur is in scratchpad.  I had
written it to support the CommandManager.  The CommandManager is used to
handle Command events, and the package also defines an EventPipeline.
The EventPipeline mapps events from a Source to an EventHandler.

Each ThreadManager is designed to have a different ThreadPool policy.
For instance, you can have one finite sized ThreadPool for all
EventPipelines, or you can have a ThreadPool per Pipeline, etc.
Currently, there is only one policy implemented, but there is room
for more.

-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


AW: create threads? or use thread manager...

Posted by Emperor <Da...@gmx.net>.

> -----Ursprüngliche Nachricht-----
> Von: Berin Loritsch [mailto:bloritsch@apache.org] 
> Gesendet: Dienstag, 26. Februar 2002 21:24
> An: Avalon Developers List
> Betreff: Re: create threads? or use thread manager...
> 
> 
> Peter Donald wrote:
> > On Wed, 27 Feb 2002 07:05, Berin Loritsch wrote:
> > 
> >>Peter Donald wrote:
> >>
> >>>On Wed, 27 Feb 2002 02:46, Emperor wrote:
> >>>
> >>>>My manager block needs long living threads (two or three, in this 
> >>>>case), should I create java.lang.Thread instances or 
> retrieve them 
> >>>>using the
> >>>>ThreadManager.getDefaultPool().execute() method, or 
> should I create a
> >>>>thread pool?
> >>>>
> >>>Up to you. I think I would create them manually if you are only 
> >>>creating2-3
> >>>
> >>Also keep in mind that ThreadManagers allow you to change 
> the policy 
> >>of thread pools easily.  For instance, if you want 2 threads per 
> >>processor, the ThreadManager has something that 
> automatically figures 
> >>that out (using SystemUtil of course).
> >>
> > 
> > Which ThreadManager are you talking about?
> 
> 
> The one in excalibur.command.ThreadManager
> 

Nope... I was walking about the
cornerstone/services/threads/ThreadManager

Is it deprecated? Should I use the excalibur one?

> 
> 
> 
> -- 
> 
> "They that give up essential liberty to obtain a little 
> temporary safety
>   deserve neither liberty nor safety."
>                  - Benjamin Franklin
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:avalon-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: create threads? or use thread manager...

Posted by Berin Loritsch <bl...@apache.org>.
Peter Donald wrote:
> On Wed, 27 Feb 2002 07:05, Berin Loritsch wrote:
> 
>>Peter Donald wrote:
>>
>>>On Wed, 27 Feb 2002 02:46, Emperor wrote:
>>>
>>>>My manager block needs long living threads (two or three, in this case),
>>>>should I create java.lang.Thread instances or retrieve them using the
>>>>ThreadManager.getDefaultPool().execute() method, or should I create a
>>>>thread pool?
>>>>
>>>Up to you. I think I would create them manually if you are only
>>>creating2-3
>>>
>>Also keep in mind that ThreadManagers allow you to change the policy of
>>thread pools easily.  For instance, if you want 2 threads per processor,
>>the ThreadManager has something that automatically figures that out
>>(using SystemUtil of course).
>>
> 
> Which ThreadManager are you talking about?


The one in excalibur.command.ThreadManager




-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: create threads? or use thread manager...

Posted by Peter Donald <pe...@apache.org>.
On Wed, 27 Feb 2002 07:05, Berin Loritsch wrote:
> Peter Donald wrote:
> > On Wed, 27 Feb 2002 02:46, Emperor wrote:
> >>My manager block needs long living threads (two or three, in this case),
> >>should I create java.lang.Thread instances or retrieve them using the
> >>ThreadManager.getDefaultPool().execute() method, or should I create a
> >>thread pool?
> >
> > Up to you. I think I would create them manually if you are only
> > creating2-3
>
> Also keep in mind that ThreadManagers allow you to change the policy of
> thread pools easily.  For instance, if you want 2 threads per processor,
> the ThreadManager has something that automatically figures that out
> (using SystemUtil of course).

Which ThreadManager are you talking about?

-- 
Cheers,

Pete

*------------------------------------------------------*
| "Common sense is the collection of prejudices        |
|  acquired by age 18. " -Albert Einstein              |
*------------------------------------------------------*

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: create threads? or use thread manager...

Posted by Berin Loritsch <bl...@apache.org>.
Peter Donald wrote:
> On Wed, 27 Feb 2002 02:46, Emperor wrote:
> 
>>My manager block needs long living threads (two or three, in this case),
>>should I create java.lang.Thread instances or retrieve them using the
>>ThreadManager.getDefaultPool().execute() method, or should I create a
>>thread pool?
>>
> 
> Up to you. I think I would create them manually if you are only creating2-3


Also keep in mind that ThreadManagers allow you to change the policy of
thread pools easily.  For instance, if you want 2 threads per processor,
the ThreadManager has something that automatically figures that out
(using SystemUtil of course).




-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: create threads? or use thread manager...

Posted by Peter Donald <pe...@apache.org>.
On Wed, 27 Feb 2002 02:46, Emperor wrote:
> My manager block needs long living threads (two or three, in this case),
> should I create java.lang.Thread instances or retrieve them using the
> ThreadManager.getDefaultPool().execute() method, or should I create a
> thread pool?

Up to you. I think I would create them manually if you are only creating2-3

-- 
Cheers,

Pete

*-------------------------------------*
| Does the name `Pavlov' ring a bell? |
*-------------------------------------*

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>