Return-Path: Delivered-To: apmail-felix-dev-archive@www.apache.org Received: (qmail 98555 invoked from network); 13 May 2009 06:22:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 May 2009 06:22:31 -0000 Received: (qmail 30864 invoked by uid 500); 13 May 2009 06:22:31 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 30780 invoked by uid 500); 13 May 2009 06:22:30 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 30770 invoked by uid 99); 13 May 2009 06:22:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 May 2009 06:22:30 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gnodet@gmail.com designates 209.85.220.163 as permitted sender) Received: from [209.85.220.163] (HELO mail-fx0-f163.google.com) (209.85.220.163) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 May 2009 06:22:19 +0000 Received: by fxm7 with SMTP id 7so470061fxm.22 for ; Tue, 12 May 2009 23:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=lAc6zrzyzEIp2xEY/Aeb+GnPVwMDqGhXgOya3d6zUcw=; b=M98ZUbu6qe8tAjxNaoo0ZZ13SNe46G8YM5NfEQ6H7UOSD96cvug0I+Rzi2SL+MdABl nqpoOyTDgCDDDz2pCY7+NXppE1S0UJmDW1+Fw/A0DOyC2pqgNIfqYMdWzffR4w9aluN5 83aC4w1MAerrJnFNiSq2L64TmvbyhjKLobVpQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=WZJc3hgzdtu2oYPrpAcQPQIGTOC6+8n9dyt+s/i6tcZ5ZihVT+B37c0n7XEUnAUL27 baBR0IlNaHcT9Wo4UGK6iRvOhVQP5iWhQmJeuMjhyO4tOwRIz0oMvMTMgNhakJ8DE64K 5CqRGYhyumuNcEdk54L3FBq1nZ7RJe1+ATSYk= MIME-Version: 1.0 Received: by 10.223.126.66 with SMTP id b2mr305622fas.3.1242195718669; Tue, 12 May 2009 23:21:58 -0700 (PDT) In-Reply-To: <487a994c0905070504u44cf4c9cy65fb52ecaeda64e0@mail.gmail.com> References: <4A02C8E7.7000403@gmail.com> <487a994c0905070504u44cf4c9cy65fb52ecaeda64e0@mail.gmail.com> Date: Wed, 13 May 2009 08:21:57 +0200 Message-ID: Subject: Re: Corner case where ServiceListener do not receive events for matching services From: Guillaume Nodet To: dev Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Actually, I think loading the class is a very bad idea. I know the lazy activation policy has not been implemented, but it would be, loading the class at this point would trigger the bundle and would kinda break the lazy activation policy. I think the only right way is to use the wires between the bundle to check if the class is compatible. 2009/5/7 Karl Pauls : > I guess the idea behind the way we currently do things is that we want > to be lazy. If we would check on the class of the object created by > the service factory we might trigger unnecessary service creations. > However, your case might force us to do that unless we can find a > smart way to figure out this information by looking at the wiring of > the bundles. From your description I doubt that this is possible but > we probably have to think about it. > > Definitely sounds to me that you should create a JIRA issue and maybe > attach your example. > > regards, > > Karl > > On Thu, May 7, 2009 at 1:49 PM, Guillaume Nodet wrote: >> On Thu, May 7, 2009 at 13:41, Felix Meschberger wro= te: >>> Hi, >>> >>> I am bit confused, too ;-) >>> >>> Guillaume Nodet schrieb: >>>> I've just finished debugging a corner case in karaf =A0where a >>>> ServiceListener did not receive events when a matching service was >>>> registered. >>>> The problem is not very simple: >>>> =A0 * the service is exposed via a ServiceFactory >>> >>> So, the ServiceFactory must create objects implementing the service >>> interface, right ? >>> >>>> =A0 * 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. >>> >>>> =A0 * the bundle exporting the service does not have a direct import o= n >>>> 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 interfac= e >>> 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) an= d >>> creating implementations located in (2) ? >>> >>> Or, maybe, I am completely wrong .... >> >> In my case, the bundle exporting the service defines a class that >> indirectly implement the required interface by inheriting a class from >> another package. >> So I have 3 bundles: >> =A0* bundle A defines an interface R and a class S in different >> packages, whith S implementing R >> =A0* bundle B defines a class T extending S, it has an import statement >> on S package, but not on R package >> =A0* bundle C defines a ServiceFactory that export T service without >> any import on any package from R, S, T >> Maybe the service registration is invalid because bundle B does not >> import R package, but the service actually implement the right >> interface >> >>> 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. =A0The 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 >>>> >>> >> >> >> >> -- >> Cheers, >> Guillaume Nodet >> ------------------------ >> Blog: http://gnodet.blogspot.com/ >> ------------------------ >> Open Source SOA >> http://fusesource.com >> > > > > -- > Karl Pauls > karlpauls@gmail.com > --=20 Cheers, Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/ ------------------------ Open Source SOA http://fusesource.com