Skip to main content

[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


Kenny

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!

Regards

Simon



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>

To
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
cc
Subject
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@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Back to the top