[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] finding a BundleContext

Tom Huybrechts wrote:
For the registration of the services I use the BundleContext of the
bundle that declares the interface, so the lifecycle of the services
will be limited to that of their bundle.

The reason I don't register the services in their own bundle's activator are:
- I don't want to repeat this for every service bundle
- The bundle shouldn't care exactly how the connection to the remote
service is handled

I have this working now, but am open to suggestions for other ways to
handle this...
I have a suggestion:

When you register a service, add a service property to indicate that this is a remote service. Use a separate bundle (like you do now) to listen to all services that are registered that have this service property (use a ServiceTracker with ServiceTrackerCustomizer and you'll get notified automatically). Have it register the remote services.

This way you're coupling the life-cycle of your remote services to the life-cycle of your services (instead of that of your bundles).

Greetings, Marcel