geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <>
Subject Re: GBeans threading best practices
Date Thu, 04 Aug 2005 01:36:51 GMT
On Aug 3, 2005, at 9:34 AM, Dain Sundstrom wrote:

> On Aug 3, 2005, at 8:13 AM, Miguel A Paraz wrote:
>> Hi,
>> I'm planning on writing my own GBeans to implement services.
>> Is it OK to start new Threads - using new Thread() directly, or
>> indirectly by using util.concurrent facilities which I see in the
>> code?
> You can start threads directly, but it is preferrable to use a  
> EDU.oswego.cs.dl.util.concurrent.Executor.  The best practice is to  
> have the Executor inject via constructor injection or setter  
> injection.  This allows a user of your service to have complete  
> control the properties of the thread pool.

Let me be a bit more clear.  I suggest you write your code to use the  
concurrent executor since it is common reusable api with many  
implementations.  When it comes to deploying your service in  
Geronimo, the Geronimo ThreadPool class implements the Executor so  
you can just use that service with a Geronimo GBean reference.


View raw message