ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google

Mail Archive Home | oscar List | December 2005 Index

<--  Date Index  --> <--  Thread Index  -->

Re: [oscar] Using services from unstarted bundles

First, let me say that I am not certain that you will see large start up costs for library bundles. Generally speaking, the costs come from loading and instantiating classes, neither of which should be happening much when you start library bundles. So, you could possible just try it first to see if you really do have a performance problem.

However, the issue might be valid as your system grows. In OSGi R4, another way to mitigate start-up costs is to use Declarative Services. The DS runtime reads component metadata and registers service factories on behalf of components without actually starting them, which eliminates a lot of class loading and instantiation. Unfortunately, there is not an open source impl of DS available yet, but we are hopeful that some work will start in the Felix project before long.

-> richard

Nick_Hofstede@xxxxxxxxxxxxxxxxxxxxxx wrote:

We started moving a project to the OSGi framework because we wanted to make
use of the module layer of OSGi and solve versioning and other classpath
In order to do this we divided our project into several bundles. These
bundles were created according to function and are library-like.

Since we're running inside an OSGi-framework we're contemplating using
services for several (pluggable) functions. Let's say we would like to use
the standard log-service for example.

The problem we're having now, is that only one of our bundles (the
application-bundle containing the entrypoint) is started. None of the
library-like bundles are started, just resolved. This means those bundles
don't have access to a BundleContext, and that means they don't have access
to services.

One solution (inspired by eclipse) is creating a Platform class in a bundle
that gets started before the application is. This bundle initializes a
static object by passing its BundleContext when it's started. Afterwards,
all library-bundles use the static Platform-class to access services or
perform other operations that require a BundleContext.

Another obious solution is starting all bundles in order to get
BundleContexts, but this is something everyone is trying to avoid due to
large startup costs.

The Platform-solution will work, but we feel it's a bit hackish, and we
were wondering if there is a better solution.
In short, what is the OSGi-answer if you have bundles that don't need/want
to be started but still need to access services (for logging for example)?

Kind regards,

Nick Hofstede

Inventive Designers' Email Disclaimer:



You receive this message as a subscriber of the oscar@xxxxxxxxxxxxx mailing 
To unsubscribe: mailto:oscar-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.