Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Initializing ResourceFilter before publisher #179

Open
tobias-- opened this issue Dec 12, 2016 · 5 comments
Open

Initializing ResourceFilter before publisher #179

tobias-- opened this issue Dec 12, 2016 · 5 comments

Comments

@tobias--
Copy link

I would like to apply a ResourceFilter as described in #96. The FAQ states that a ResourceFilter has to be registered before the publisher. When I register the ResourceFilter as a DS, the publisher is already started and the AllServicesTracker is being used. Do I really need to manually start the publisher bundle after the ResourceFilter is registered? In my current setup the publisher bundle is installed and started alongside every other bundle. Starting a single bundle manually seems very inconvenient.

Am I missing something?

@doggy-dev
Copy link

Hello @tobias-- ,
are you starting an RCP application? If so you can set the start levels of your bundles and just start your bundle with the ResourceFilter one level earlier as the publisher.

@tobias--
Copy link
Author

Hi @doggy-dev,
I am using the launcher from bndtools, which installs and launches all runbundles (in order) after starting the framework. However, specifying the bundle containing the filter before the publisher does not seem to suffice: The filter does not get picked up until I manually restart the publisher bundle.

Yes, I certainly could change the way and order bundles are being installed, but maybe there could be a way (possibily a system property?!) to change the (greedy) default behaviour of the publisher to track all services.

@doggy-dev
Copy link

Sorry, I'm not familiar with this launcher.
Maybe you shoud debug and checkif the order is really applied. Also make sure you have lazy-loading in your bundle manifest with the DS ResourceFilter.
You should take in account that not the install or resolve order is important in this case, but the start order of the bundles.
On the linked page I can't see anything about run order. Maybe there isn't any. Am I missing something?

@BryanHunt
Copy link
Collaborator

In general, if you have to set a specific start order for your bundles, something is wrong. If someone wants to dig into this and provide a PR, I'll give that priority over the holidays when I start looking at this project again.

@doggy-dev
Copy link

Yes, unfortunately something is wrong with the connector itself. It doesn't wait for a ResourceFilter service. It touches and initializes every service found in the osgi container. See #96 .
Now if you have a Hibernate service factory e.g. you'll get couple of nasty exceptions about missing configs. A require-capability may be a nice solution for the next major release.

But the discussion gets off topic here. Creating a new issue is better.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants