I'm not following what you are talking about?
Anything you getTarget() during the install() phase should have
a corresponding ungetTarget() during the uninstall() of the lifecycle.
If somebody is using the api manually (either the MC api directly or the OSGi api)
then it is up to them to make sure they don't have stale references.
With OSGi the references can go stale at anytime anyway, which is why the
service notification mechanism exists (in principle we should automatically
respond those if IOC is used and "redeploy" whatever it was injected into?)
Even if they do, they will/should be tidied up at Deployment/Bundle.stop()
when the ServiceTracking for that context should be disabled/cleaned up.
The ServiceFactory is just a lazy version of the service. i.e. you only construct it
if somebody wants to use it. Its still a singleton. It only controls when the object
is constructed (first access instead of upfront).
View the original post :
Reply to the post :