Hi,

I am bit confused, too ;-)

Guillaume Nodet schrieb:
> I've just finished debugging a corner case in karaf  where a
> ServiceListener did not receive events when a matching service was
> registered.
> The problem is not very simple:
>   * the service is exposed via a ServiceFactory

So, the ServiceFactory must create objects implementing the service
interface, right ?

>   * the service factory does not belong to the same classloader as
> the interface of the exposed service

No problem. In case the factory and service interface are in different
bundles, this is expected.

>   * the bundle exporting the service does not have a direct import on
> the interface exposed

You mean, the bundle registering the ServiceFactory ?

In this case, I would assume, this is an invalid service registration,
since the registering bundle does not know about the service interface,
unless the service interface is contained in the same bundle as the
ServiceFactory implementation.

This leads to the suspicion, that there are two actual service interface
class objects: The public one used by the listener and another one
(exported or not) used by the ServiceFactory implementation.

Or are there three bundles ? (1) exporting the service interface, (2)
exporting the service implementation and (3) registering the
ServiceFactory as a service for the service interface defined by (1) and
creating implementations located in (2) ?

Or, maybe, I am completely wrong ....

Regards
Felix

> 
> This leads to the service listener not being invoked because
> Util.isServiceAssignable() returns false.
> I think it's a problem, but I've no idea how to solve it.  The only
> way I can think about is to actually check the service class returned
> by the factory instead of the factory, but it may cause side effects,
> not sure.
> 
> Thoughts?
> 
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
> 

Reply via email to