On 23/11/2016 15:19, Peter Kriens wrote:
DS should never call your activate twice. That said, I’ve seen the Felix impl do this if you throw an exception from activate. It might maybe do this when your activate does not return? However, then you should some information from SCR in your log file.

If you properly end your thread in deactivate then things should work out fine.

Your executor code in the previous mail looked very strange, why call an executor when you wait for the result? It might help to show a skeleton of your code so we can look at it.

That wasn't my code, somebody else posted that. I just start the thread in @Activate it and interrupt it in @Deactivate (not that that matters, because @Deactivate doesn't get called, so it's irrelevant to this problem whether my thread termination code works or not).

You also do not show how you stop your thread. You are sure you are using the right method? Interrupts work best usually. See http://enroute.osgi.org/appnotes/concurrency.html

If you have configuration you could get a created/deleted/created but this should follow the invariants. If you want to prevent this then set the configurationPolicy=REQUIRE. I also generally use factories even if only one is required. This is how I normally use components. This is one of the main reasons for the configurer so that proper configuration is available for all my components in my application bundle. The idea is to write reusable components that parameterized by a single bundle that acts as the root of your application.

Another explanation is if DS is installed 2x. This will obviously cause problems.

Kind regards,

Peter Kriens


--
Tim Ward

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to