Return-Path: X-Original-To: apmail-aries-dev-archive@www.apache.org Delivered-To: apmail-aries-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6F42010B77 for ; Thu, 6 Feb 2014 13:12:25 +0000 (UTC) Received: (qmail 76093 invoked by uid 500); 6 Feb 2014 13:12:21 -0000 Delivered-To: apmail-aries-dev-archive@aries.apache.org Received: (qmail 75967 invoked by uid 500); 6 Feb 2014 13:12:19 -0000 Mailing-List: contact dev-help@aries.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aries.apache.org Delivered-To: mailing list dev@aries.apache.org Received: (qmail 75891 invoked by uid 99); 6 Feb 2014 13:12:17 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Feb 2014 13:12:17 +0000 Date: Thu, 6 Feb 2014 13:12:16 +0000 (UTC) From: "David Bosschaert (JIRA)" To: dev@aries.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (ARIES-1157) SPI-Fly does not support bundles that are both providers and consumers of the same API MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/ARIES-1157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] David Bosschaert resolved ARIES-1157. ------------------------------------- Resolution: Invalid It actually *does* work. I added a demo to the spi-fly examples that shows it working: http://svn.apache.org/viewvc?view=revision&revision=1565220 The reason why it appeared to not work in the previously attached example, was because the example was invoking the SPI directly in the {{BundleActivator.start()}} method. As SPI providers are registered asynchronously by SPI Fly after the provider bundle is started, this process hasn't happened yet. So basically the attached demo was invoking the SPI before it had a chance to register itself properly. I think this dynamism is acceptable and actually very much the way OSGi is designed, so it's not an error. It does impose a timing constraint on the user of the SPI if it's used via {{ServiceLoader.load()}}. This is a disadvantage of using this API. A better solution would be to use the SPI via the OSGi Service Registry at which point you can use ordinary OSGi service dependencies and your timing issue is resolved. > SPI-Fly does not support bundles that are both providers and consumers of the same API > -------------------------------------------------------------------------------------- > > Key: ARIES-1157 > URL: https://issues.apache.org/jira/browse/ARIES-1157 > Project: Aries > Issue Type: Bug > Reporter: David Bosschaert > Assignee: David Bosschaert > Attachments: org.apache.aries.spifly.examples.provider.consumer.bundle-1.0.1-SNAPSHOT.jar > > > When creating a bundle that is both an SPI provider and an SPI consumer the consumer does not find the provider. > This has been observed with a bundle that does not provide the SPI API, but contains both the provider jar as well as the consumer jar, which is invoked from the activator. > The bundle contains both these headers: > {code}SPI-Consumer: * > SPI-Provider: *{code} > Note that this problem can be observed in Felix but not in Equinox because Equinox sets the TCCL to the current bundle by default. -- This message was sent by Atlassian JIRA (v6.1.5#6160)