You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Quecas <jm...@gmail.com> on 2011/11/13 11:17:23 UTC

persistent services

Hello Felix users,

I think my question kinda overlaps the "stale reference" issue. In my use
case however, a "stale reference" would actually be regarded as a
"persistent reference" and therefore a positive thing.

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.

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?

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: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: persistent services

Posted by Quecas <jm...@gmail.com>.
Hi Neil,

I had a closer look at my implementation and it turned out I was mislead by
a lack of log entries. When the module is stopped I am closing the logger
service tracker and thereby disabling future logging, but the execution does
complete.

Thanks
Jorge
-- 
View this message in context: http://old.nabble.com/persistent-services-tp32834412p32835367.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: persistent services

Posted by Neil Bartlett <nj...@gmail.com>.
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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org