From dev-return-51009-archive-asf-public=cust-asf.ponee.io@felix.apache.org Thu Mar 15 03:10:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id C5FDE18067B for ; Thu, 15 Mar 2018 03:10:04 +0100 (CET) Received: (qmail 22145 invoked by uid 500); 15 Mar 2018 02:10:03 -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 22132 invoked by uid 99); 15 Mar 2018 02:10:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2018 02:10:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 1D4B4C0323 for ; Thu, 15 Mar 2018 02:10:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id PKh6BU38LMju for ; Thu, 15 Mar 2018 02:10:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id E69F35F5B2 for ; Thu, 15 Mar 2018 02:10:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5D587E00B8 for ; Thu, 15 Mar 2018 02:10:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 1168B2148D for ; Thu, 15 Mar 2018 02:10:00 +0000 (UTC) Date: Thu, 15 Mar 2018 02:10:00 +0000 (UTC) From: "Matt Pavlovich (JIRA)" To: dev@felix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FELIX-5802) Service Component created via xml defines scope='singleton' and service specifies property with scope='bundle' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FELIX-5802?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1639= 9784#comment-16399784 ]=20 Matt Pavlovich commented on FELIX-5802: --------------------------------------- This detection logic should handle when m_factory !=3D null && the m_factor= y is an instance of=C2=A0'org.apache.felix.scr.impl.manager.SingleComponent= Manager' (plain org.osgi.service.ServiceFactory) and not an instance of Pro= totypeServiceFactory. =C2=A0 {noformat} if ( m_factory !=3D null ) { props.put(Constants.SERVICE_SCOPE,=20 (m_factory instanceof PrototypeServiceFactory ? Constants.SCOPE_P= ROTOTYPE : Constants.SCOPE_BUNDLE)); } else { props.put(Constants.SERVICE_SCOPE, Constants.SCOPE_SINGLETON); }{noformat} > Service Component created via xml defines scope=3D'singleton' and service= specifies property with scope=3D'bundle' > -------------------------------------------------------------------------= ------------------------------------- > > Key: FELIX-5802 > URL: https://issues.apache.org/jira/browse/FELIX-5802 > Project: Felix > Issue Type: Bug > Components: Framework > Affects Versions: framework-5.6.10 > Reporter: Matt Pavlovich > Priority: Major > > Component with scope=3D'singleton' created via xml or annotation has the = service registered with a property of service.scope=3D'bundle' > Project reproducing the issue is=C2=A0available here:=C2=A0[https://githu= b.com/mattrpav/karaf-5664]=C2=A0 > Steps to reproduce: > # Define a serviceComponent via xml (or osgi ds annotation) > # Deploy bundle > # run scr:info (observe Service Scope: singleton) > # run service:list (observe service.scope =3D bundle) > Investigation: > * Service registers with property of 'service.scope=3Dbundle' here: [htt= ps://github.com/apache/felix/blob/trunk/framework/src/main/java/org/apache/= felix/framework/ServiceRegistrationImpl.java#L327] > * Debugging in felix.scr confirms=C2=A0that the xml is being parsed corr= ectly and the returned component metadata shows the 'scope' =3D 'singleton'= correctly=C2=A0[o.a.felix.scr.impl.xml.XmlHandler#L362|https://github.com/= apache/felix/blob/trunk/scr/src/main/java/org/apache/felix/scr/impl/xml/Xml= Handler.java#L362] > * Debugging confirms that felix.scr is detecting DS13 namespace > =C2=A0scr:info output: > {noformat} > karaf@root()> scr:info TestModule > *** Bundle: com.foo.test-module (124) > Component Description: > Name: BundleModule > Implementation Class: com.foo.TestModule > Default State: enabled > Activation: immediate > Configuration Policy: optional > Activate Method: activate > Deactivate Method: deactivate > Modified Method: - > Configuration Pid: [TestModule] > Services:=20 > com.foo.api.Module > Service Scope: singleton > Component Description Properties: > Component Configuration: > ComponentId: 4 > State: active=20 > Component Configuration Properties: > component.id =3D 4 > component.name =3D TestModule{noformat} > service:list output > {noformat} > karaf@root()> service:list > [com.foo.api.Module] > ------------------------ > component.id =3D 4 > component.name =3D TestModule > service.bundleid =3D 124 > service.id =3D 141=20 > service.scope =3D bundle > Provided by : > Company :: Foo :: TestModule (124){noformat} > OSGI-INF/serviceComponent.xml > {noformat} > > > > > > > {noformat} > =C2=A0 > Note: When the same impl class is reconfigured to register as a service v= ia BundleActivator, the service has a service.scope =3D 'singleton'=C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)