> It fails because equinox's FiltereServiceListener (as ServiceTracker
> registers a ServiceListener) does the following:
>
> if (allservices || ServiceRegistry.isAssignableTo(context, reference)) {
> ....
> }
>
> The call to ServiceRegistry.isAssignableTo(context, reference) fails when
> context (A) does not import package of reference ("foo")
>
> Is this a bug?
ServiceRegistry.isAssignableTo(context, reference) seems to be doing its job.
" This method performs the following checks:
1. Get the package name from the specified class name.
2. For the bundle that registered the service referenced by this
ServiceReference (registrant bundle); find the source for the package.
If no source is found then return true if the registrant bundle is
equal to the specified bundle; otherwise return false."
Ding! No source is found for the package for A, and A != B.
So the question is whether ServiceRegistry.isAssignableTo(context,
reference) is a necessary condition for ServiceTracker. As I understand
Peter's post, it is too narrow a constraint because it excludes the
(unusual) case where no source for the package is found in 'context'.
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev