Thanks, Richard, please help to check my comments.
2009/11/26 Richard S. Hall <[email protected]>
> On 11/25/09 21:49, Ivan wrote:
>
>> Hi,
>> While trying the Felix as the OSGI runtime, I have some questions
>> about
>> the resolve policy, please help to give some comments, thanks !
>> 1. Can an import connection be wired to an installed (not resolved)
>> bundle ? I found there is description in the spec 3.7, which says "A
>> resolved exporter must be preferred over an unresolved exporter.". So does
>> it mean that the answer is yes ?
>>
>>
>
> All bundles must be resolved to have wires and to have wires to them. The
> spec is just saying you should prefer already resolved bundles over bundles
> that you must yet resolve.
>
>
> 2. I have a bunlde A and bundle B, bundle A needs to import some
>> packages
>> from bundle B. But my installation order is that first A, then B. From the
>> log messages, I could see after installing A, FelixDispatchQueue said that
>> bunldle A is in the installed state. Then I install B, the messages showed
>> that " Bundle B resolved, Bundle A resloved". I wonder when the resolve
>> action will occured ? Will Felix check whether all the installed bundle
>> could be resolved once a new bundle is installed or resolved ?
>>
>>
>
> Felix does not try to resolve bundles automatically, it only resolves them
> on demand. Typically this is when you try to start a bundle, which will
> resolve that bundle plus the bundles on which it depends transitively.
Let's say we have three bundles A, B, C.
A depends on both B and C.
B depends on C.
The installation order is A, B, C. After installing them, their status
should be :
A : installed
B : installed
C: resolved
Then I start them in the same order.
While starting bundle A, Felix will first try to resolve B, or A could be
resolved as its import requirements can not be fulfilled. In other words,
although a "real" wire connection had not been established between A and B,
as B is in _installed_ status, but there may be a "candidate" connection
existed between A and B, so Felix knows it has to first resolve B ?
>
> 3. Related to question 2, if I have ten bundles and I am sure that each
>> bundle could find export packages from other nine bundles. But I do not
>> install them according to their dependency relations. Then, will the logic
>> below work correctly ? In my tests, it seems that they could work
>> correctly.
>> String[] locations = {......};
>> Bundle[] bundles = new Bundles[locations.length];
>> for(int i=0;i<locations.length;i++) {
>> bundles[i] = bundleContext.installBundle(locations[i]);
>> }
>> for(Bundle b : bundles) {
>> b.start();
>> }
>>
>>
>
> Yes. For example, if all of your bundles are installed and started, on a
> subsequent restart of the framework, it will first reinstall all bundles in
> one pass, then start them in another pass, which ensures dependencies can be
> satisfied.
>
> The above code does the same thing.
>
>
-> richard
>
> Ivan
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Ivan