Jorge, the following is incorrect, or at least not quite accurate: > Suppose I grab a ServiceReference s1, I use s1 and it takes time T to > complete, meanwhile at approx. T/2 s1's bundle is UNREGISTERED,STOPPED and > UNINSTALLED causing the previous execution of s1 to not complete.
Stopping and even uninstalling a bundle does NOT necessarily cause the previous execution to fail. In many cases the execution will continue until completion. However it depends on the internal implementation details of the service. For example, if the service provider detects that it has been stopped then it may attempt to terminate any long-running service invocations that are in progress. Alternatively, the service invocation may be manipulating a resource (e.g. a file) that has been removed due to the stopping of the bundle; this would also cause early termination of the service. >From the caller side you may detect the unregistration of the service that you are currently using and attempt to kill the thread invoking it. But none of this is done automatically. > I've noticed that in some cases, references persist while others don't - > using the "stale reference" while execution is not complete and using a "new > reference" for new acquisitions of the service - is there any way to > guarantee that an execution (usage) of a service will complete using the > already acquired service instance? There are no guarantees with services. You cannot guarantee that the service invocation will complete, because you don't know what it is doing inside its implementation, and it may simply be impossible for it to complete due to an external condition. Regards, Neil > > Thanks > Jorge > -- > View this message in context: > http://old.nabble.com/persistent-services-tp32834412p32834412.html > Sent from the Apache Felix - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

