[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] is a bundle equal to a java thread

Thanks for the replies.
So there is only one thread from framework to handle the bundles' start-up, and when
bundles be started, there is no new threads be created.
But how OSGi framework provides so many bundles services which can be accessed
simultaneously ? or framework creates a thread for each BundleContext ?
Thanks again.
On 8/27/06, Simon J Archer <sarcher@xxxxxxxxxx> wrote:


Bundles are started on a thread that is owned by the OSGi framework, so it is important that your BundleActivator (which is optional) returns from start(BundleContext) and stop(BundleContext) as quickly as possible. Most bundles start quickly enough that they don't need to spawn their own thread, but spawning your own thread is not out of the question.  With regards to stop(BundleContext), the bundle must stop and clean up all its resource before returning.  This obviously means that you can't spawn a new thread to perform stop!



Marcel Offermans <marcel.offermans@xxxxxxxxxx >
Sent by: equinox-dev-bounces@xxxxxxxxxxx

08/26/2006 12:56 PM

Please respond to
Equinox development mailing list < equinox-dev@xxxxxxxxxxx>

Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
Re: [equinox-dev] is a bundle equal to a java thread

Hello Kenny,

On Aug 26, 2006, at 18:48 , Kenny Su wrote:

> I am just getting starting with OSGI and new to here.
> When a bundle be started by framework, does it mean starting
> a java thread or more java threads ?

No, when a bundle is started, no new thread is created.

When you create a bundle that contains a BundleActivator, the  
framework will invoke the start() method when your bundle is started.

It is not uncommon for a bundle to spawn a thread itself (in the start
() method). Make sure you clean it up again in the stop() method.

Greetings, Marcel

equinox-dev mailing list

equinox-dev mailing list