2009/6/15 Todor Boev <t.b...@prosyst.bg>

> Todor Boev wrote:
> > Richard S. Hall wrote:
> >> Yes. iPOJO is of the philosophy that service departures will likely lead
> >> to errors, so you are better off being prepared to catch them and fail
> >> gracefully, sort of like errors in distributed computing. Even if you
> >> hold a dedicated lock, there is no guarantee that calling a method on
> >> the service object won't throw an exception. Locks don't stop the
> >> service from going away (think bluetooth device), in some cases if it
> >> goes away it is gone, period.
> >>
>
> Ah..I get it! You mean we should not bother to block the unexport of the
> service
> when the framework calls into our ServiceListener because that won't keep
> the
> service functional until our last calls to it return. Come to think of a
> service
> can throw an exception due to a missing transitive dependency anyway. Seems
> I am
> still not completely free from that "safe" mentality :P
>

exactly!  there's not much point in artificially keeping a bundle from
unregistering
a service because in the case of a hardware problem if it's gone, it's
really gone.

Seems in the end we should count on the service exporter to toss exceptions
> at
> us rather than do random nastiness out of a partially destroyed service.
>

yes, at least in Java we have some added safety above C because any objects
you have strong references to will be kept, and not junked - however this is
no
guarantee that the contents are still valid, or external resources still
exist.

btw, one major design point in peaberry was accurately tracking who's using
a
service - this means that a bundle that's registered a service could
unregister it
then wait for "Bundle.getUsingBundles()" to return an empty list (probably
also
have a timeout in case a call takes to long) before freeing its resources

unregistering the service first means we shouldn't pick up any more callers,
so
we just have to wait for the currently active callers to complete then
gracefully
finish shutting down the service

of course you have to be careful that a reference to the service hasn't
escaped,
but that's a good reason (imho) why you should use a framework like peaberry
:)

Todor
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
> For additional commands, e-mail: users-h...@felix.apache.org
>

-- 
Cheers, Stuart

Reply via email to