aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Bosschaert (JIRA)" <>
Subject [jira] [Resolved] (ARIES-1157) SPI-Fly does not support bundles that are both providers and consumers of the same API
Date Thu, 06 Feb 2014 13:12:16 GMT


David Bosschaert resolved ARIES-1157.

    Resolution: Invalid

It actually *does* work. I added a demo to the spi-fly examples that shows it working:

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:
>             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

View raw message