Check if Feature was fully installed?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Check if Feature was fully installed?

lechlukasz

Hello,

 

Sorry for asking once again, but making my application run after updating Karaf to version 4.2.1 is giving me headache…  Many things that have worked before doesn’t work without obvious reason…

 

I was installing features with my own code. I’ve called FeatureService.installFeatures() and after it returned, I was issuing SystemService.halt(). Afterwards I’ve got Karaf that was ready to be packaged and delivered into test.

 

In 4.2.1 this doesn’t work because my code, which is a feature on its own, is restarted when I call installFeatures, therefore I get InterruptedException. In that moment, when I stop Karaf, I’ll stop installing features and end up with Karaf with incomplete set of bundles.

 

So I’ve decided to do otherwise: provide a channel which I can ask if all features were installed. I call for feature status with FeatureService.getState(featureId) and when I get true, I return OK. Then the build script issues ./bin/stop to stop karaf. But then I’m getting karaf container that have all bundles, but after starting, many of them are ‘Resolved’, not started.

 

Why it is so? Do the SystemService.halt() makes more ‘gentle’ shutdown then ./bin/stop ? Or I’m stopping Karaf prematurely, before the start was issued on each bundle? How can I check then, when it’s OK to stop Karaf? I can’t assume how long will it take, we have gitlab based build pipeline, so the build time is strongly dependent on the load put on build machines.

 

I can’t check for bundle status because bundles won’t start correctly in build environment, but previously it was exactly the same. Nevertheless, in non-build environment, where all dependencies were provided, every single bundle was started after starting karaf…

 

Best Regards,

Lukasz Lech

 

Reply | Threaded
Open this post in threaded view
|

Re: Check if Feature was fully installed?

jbonofre
Hi,

You have to use sync mode or check that the feature is started.

Did you check if you don't have refresh on your bundles, probably due to
optional imports ?

Can you ping me private to help you ?

Regards
JB

On 12/09/2018 11:38, Lukasz Lech wrote:

> Hello,
>
>  
>
> Sorry for asking once again, but making my application run after
> updating Karaf to version 4.2.1 is giving me headache…  Many things that
> have worked before doesn’t work without obvious reason…
>
>  
>
> I was installing features with my own code. I’ve called
> FeatureService.installFeatures() and after it returned, I was issuing
> SystemService.halt(). Afterwards I’ve got Karaf that was ready to be
> packaged and delivered into test.
>
>  
>
> In 4.2.1 this doesn’t work because my code, which is a feature on its
> own, is restarted when I call installFeatures, therefore I get
> InterruptedException. In that moment, when I stop Karaf, I’ll stop
> installing features and end up with Karaf with incomplete set of bundles.
>
>  
>
> So I’ve decided to do otherwise: provide a channel which I can ask if
> all features were installed. I call for feature status with
> FeatureService.getState(featureId) and when I get true, I return OK.
> Then the build script issues ./bin/stop to stop karaf. But then I’m
> getting karaf container that have all bundles, but after starting, many
> of them are ‘Resolved’, not started.
>
>  
>
> Why it is so? Do the SystemService.halt() makes more ‘gentle’ shutdown
> then ./bin/stop ? Or I’m stopping Karaf prematurely, before the start
> was issued on each bundle? How can I check then, when it’s OK to stop
> Karaf? I can’t assume how long will it take, we have gitlab based build
> pipeline, so the build time is strongly dependent on the load put on
> build machines.
>
>  
>
> I can’t check for bundle status because bundles won’t start correctly in
> build environment, but previously it was exactly the same. Nevertheless,
> in non-build environment, where all dependencies were provided, every
> single bundle was started after starting karaf…
>
>  
>
> Best Regards,
>
> Lukasz Lech
>
>  
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Check if Feature was fully installed?

lechlukasz
Hello,

It looks like I've solved this problem by adding additional check: I check
the state of all bundles after all features are 'Started'.
The bundle can be Active, GrantPeriod or Failure, but ought not to be simply
'Resolved'.

This additional check asserts, that all bundles are kicked out of 'Resolved'
State before stopping karaf.

I'd say it works after about 100 succesfull builds producing stable
dockerized distribution. Until that, I'm using caucious statement "it looks
like it's solved".

But if additional check is needed, it mean, that FeatureService reports
feature to be installed before all bundles from that feature were triggered
to be started. However, FeatureService.installServices() returns after
bundle.start was invoked. It's only my suspicion, people who implemented
that part could tell better.



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html