Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D13FE200C82 for ; Fri, 12 May 2017 12:53:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CFF1B160BA3; Fri, 12 May 2017 10:53:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2A91C160BB8 for ; Fri, 12 May 2017 12:53:09 +0200 (CEST) Received: (qmail 8790 invoked by uid 500); 12 May 2017 10:53:08 -0000 Mailing-List: contact dev-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list dev@sling.apache.org Received: (qmail 8694 invoked by uid 99); 12 May 2017 10:53:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 May 2017 10:53:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id BF3D1C1232 for ; Fri, 12 May 2017 10:53:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.201 X-Spam-Level: X-Spam-Status: No, score=-99.201 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id RVarMASlV3xJ for ; Fri, 12 May 2017 10:53:05 +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 9BBE95F36B for ; Fri, 12 May 2017 10:53:05 +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 16417E05A2 for ; Fri, 12 May 2017 10:53:05 +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 48C3E24333 for ; Fri, 12 May 2017 10:53:04 +0000 (UTC) Date: Fri, 12 May 2017 10:53:04 +0000 (UTC) From: "Justin Edelson (JIRA)" To: dev@sling.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SLING-6852) A question about reliability of keeping non DS tracked references MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 12 May 2017 10:53:10 -0000 [ https://issues.apache.org/jira/browse/SLING-6852?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1600= 7947#comment-16007947 ]=20 Justin Edelson commented on SLING-6852: --------------------------------------- it would be best to ask generic OSGi questions on the osgi-dev mailing list= . In this specific example, I'm not sure what you mean by "listener services"= . ModelAdapterFactory creates a BundleListener *object* whose lifecycle it = controls. In turn, the BundleListener registers a number of services, but a= gain it controls their lifecycle. So you could say that ModelAdapterFactory= is responsible for the lifecycle of those services, but there's no "listen= er services" per se. I should note that while this pattern is relatively common in Sling, it isn= 't something recommended for "normal" users of OSGi. Sling is a provider of= infrastructure and so ends up using more low-level features than normal ap= plications. > A question about reliability of keeping non DS tracked references > ----------------------------------------------------------------- > > Key: SLING-6852 > URL: https://issues.apache.org/jira/browse/SLING-6852 > Project: Sling > Issue Type: Task > Components: Best practices > Affects Versions: Sling Models Impl 1.2.0 > Reporter: Dominik Smog=C3=B3r > Priority: Minor > > It's a generic best practice question but illustrated on an example withi= n sling models. > We have 2 kind osgi services being in parent - child=20 > 1. a factory service that programmatically registers number listener serv= ices=20 > 2. the listener services. > The listener services are called asynchronously (usually in a white board= manner) by some 3rd party components.=20 > Now, the listener services implementations are keeping a simple object re= ferences to the parent service. Osgi is not aware of this link and is not t= racking it in any way. > An example of such a relation is here http://grepcode.com/file/repo1.mave= n.org/maven2/org.apache.sling/org.apache.sling.models.impl/1.2.0/org/apache= /sling/models/impl/ModelAdapterFactory.java#900: > with the ModelAdapterFactory creating instances of ModelPackageBundleLis= tener which self register themselves with BundleTracker. > No the question is: what guarantee do we have that the child services wil= l never use defunct instances of parent objects after they have been deacti= vated by OSGI (for whatever reason)? > Isn't it a potential for race conditions (that partner is used frequently= throughout sling code base) during after related to bundle / component res= tarts? > (disclaimer: I've used the highest sling models version that's there on g= repcode) -- This message was sent by Atlassian JIRA (v6.3.15#6346)