NJB> Given that there is no way to take an object away from someone who has a
> reference to the object, the service contract should state the behavior of
> the object outside of its defined life time.

I remember a conversation with Peter a few years ago where Peter was
wondering whether it would be possible to tell a Java runtime to forcibly
clean up a class loader, which would imply nulling out all references to
instances of classes which it had loaded.  I think that at the time I said
it was simply impossible; nowadays I would say it is technically possible
but violates Java semantics in a way which is probably unacceptable (and
the runtime overhead could be significant).

A service could send a very strong signal to its users by only returning
WeakReference's to the objects it creates instead of direct references to
the object itself.  Of course the service user can sabotage this by
cacheing a strong reference to the object.

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to