felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart McCulloch <mccu...@gmail.com>
Subject Re: import package config
Date Tue, 15 May 2012 16:02:53 GMT

On 15 May 2012, at 16:50, <Chad.Davis@emc.com> wrote:

>> 
>> If you know the full package names then list them in Import-Package, if not
>> then use:
>> 
>>   <DynamicImport-Package>mypackages.*</DynamicImport-Package>
>> 
> 
> Is either way preferred?  Is say this because it's obviously nicer to have the wild carding.

Quoting from http://wiki.osgi.org/wiki/DynamicImport-Package:

   "Though DynamicImport-Package can be a life saver in certain circumstances it does revert
the OSGi Framework to a very expensive class path for the packages involved. With DynamicImport-Package
the OSGi Framework must revert to searching the public exported packages to find a match instead
of the careful normal calculation. Especially using the wildcard is very harmful. The need
for DynamicImport-Package usually is a symptom of a non-modular design"

There are other approaches you can use to avoid dynamic class lookup, such as defining a service
API to provide instances and then getting implementors to create bundles that register services
for their implementations. You can usually avoid a lot of legacy classloader/lookup code by
switching over to services.

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message