You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Mahammad Nasir <ma...@huawei.com> on 2010/04/14 11:49:45 UTC

How to solve Startup dependency

Hi 
 
I have a situation.
 
2 Threads are trying to install, start bundles. Thread 1 trying to install
and start bundle A. Thread 2 is trying to install and start Bundle B.
Thread 2 always starts after Bundle A.start() called. (Before start
returns).  Bundle B is dependent on Bundle A. and it requires Bundle A in
active state.
 
I want to know, is there any way i can ensure that, Bundle B will start only
after A is started?I mean can i specify this contraint? 
 
I know i can have a listner and wait for the status of the Bunlde A and then
start B. But for some reason this isnt good solution for my problem domain.
 
Pls help me.


 

Re: How to solve Startup dependency

Posted by Marcel Offermans <ma...@luminis.nl>.
On Apr 20, 2010, at 10:04 , Mahammad Nasir wrote:

> I think this would have solved my problem.Since In my case I have the right
> to chose startup order. 
> 
> But problem is I have to specify start level order in Manifest file. (Not
> programatically) . Is there is any way I can specify this in Manifest file?
> 
> AFAIK it is not possible. But I feel start level is also best candidate to
> become a property in Manifest file. Why it is missed?

Because a start level is not a property of a bundle, but a property of a bundle in a given context (application, deployment, ...). We would never be able to agree on a global startlevel for any specific bundle.

You can probably best solve these issues by using your own management agent bundle. That bundle would then be responsible for starting up all other bundles in your framework (and in general managing their life cycle). From this management agent you could decide to:

1) install all bundles your application needs
2) somehow read their configured start levels and set them
3) start all bundles and set the framework to its intended start level

Greetings, Marcel


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


RE: How to solve Startup dependency

Posted by Mahammad Nasir <ma...@huawei.com>.
 
I think this would have solved my problem.Since In my case I have the right
to chose startup order. 

But problem is I have to specify start level order in Manifest file. (Not
programatically) . Is there is any way I can specify this in Manifest file?

AFAIK it is not possible. But I feel start level is also best candidate to
become a property in Manifest file. Why it is missed?

Regards
Nasir

-----Original Message-----
From: Richard S. Hall [mailto:heavy@ungoverned.org] 
Sent: Wednesday, April 14, 2010 6:39 PM
To: users@felix.apache.org
Subject: Re: How to solve Startup dependency

You can install bundle B into a higher start level, but you'd probably be
better off not making it brittle like this.

-> richard

On 4/14/10 5:49, Mahammad Nasir wrote:
> Hi
>
> I have a situation.
>
> 2 Threads are trying to install, start bundles. Thread 1 trying to 
> install and start bundle A. Thread 2 is trying to install and start Bundle
B.
> Thread 2 always starts after Bundle A.start() called. (Before start 
> returns).  Bundle B is dependent on Bundle A. and it requires Bundle A 
> in active state.
>
> I want to know, is there any way i can ensure that, Bundle B will 
> start only after A is started?I mean can i specify this contraint?
>
> I know i can have a listner and wait for the status of the Bunlde A 
> and then start B. But for some reason this isnt good solution for my
problem domain.
>
> Pls help me.
>
>
>
>
>    

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


Re: How to solve Startup dependency

Posted by "Richard S. Hall" <he...@ungoverned.org>.
You can install bundle B into a higher start level, but you'd probably 
be better off not making it brittle like this.

-> richard

On 4/14/10 5:49, Mahammad Nasir wrote:
> Hi
>
> I have a situation.
>
> 2 Threads are trying to install, start bundles. Thread 1 trying to install
> and start bundle A. Thread 2 is trying to install and start Bundle B.
> Thread 2 always starts after Bundle A.start() called. (Before start
> returns).  Bundle B is dependent on Bundle A. and it requires Bundle A in
> active state.
>
> I want to know, is there any way i can ensure that, Bundle B will start only
> after A is started?I mean can i specify this contraint?
>
> I know i can have a listner and wait for the status of the Bunlde A and then
> start B. But for some reason this isnt good solution for my problem domain.
>
> Pls help me.
>
>
>
>
>    

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


Re: How to solve Startup dependency

Posted by Christopher Brind <ch...@googlemail.com>.
The simple answer is no.  You can have bundle-level dependencies (generally
considered bad form though), but you can't specify a dependency on a
bundle's state as far as I know, since the bundle dependencies are used for
resolution only, not without using a listener as you say, anyway.

The question I have is what requires you to have bundle dependencies like
this?

If you are waiting for services to be registered look at using a component
(e.g. Declarative Services) which will be injected with the services it
depends on and then activated when all dependencies are satisfied.  If you
have some magic happening in your activator which another bundle depends on
then this is a prime candidate for declarative services.

Cheers,
Chris



On 14 April 2010 10:49, Mahammad Nasir <ma...@huawei.com> wrote:

> Hi
>
> I have a situation.
>
> 2 Threads are trying to install, start bundles. Thread 1 trying to install
> and start bundle A. Thread 2 is trying to install and start Bundle B.
> Thread 2 always starts after Bundle A.start() called. (Before start
> returns).  Bundle B is dependent on Bundle A. and it requires Bundle A in
> active state.
>
> I want to know, is there any way i can ensure that, Bundle B will start
> only
> after A is started?I mean can i specify this contraint?
>
> I know i can have a listner and wait for the status of the Bunlde A and
> then
> start B. But for some reason this isnt good solution for my problem domain.
>
> Pls help me.
>
>
>
>