On 15 May 2012, at 16:50, <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to