mtkilbay
mtkilbay

Reputation: 121

Karaf Bundle.getState() doesn't exactly match bundle's status in bundle:list

how does the karaf client's bundle:list command determine the bundles' states? When a bundle show "Failure" in bundle:list, programmatically running this bundle's getState() (to display on a gui) shows Active. Is there another api i can use to determine if the bundle is in Failure state? Karaf version is 4.1.5 although it shows on earlier versions too. Thanks.

Upvotes: 0

Views: 273

Answers (1)

Joel
Joel

Reputation: 11

I've had a similar situation. If you look at the Karaf sources for the bundle:list, you'll notice that they use org.apache.karaf.bundle.core.BundleInfo to get the state via org.apache.karaf.bundle.core.BundleService =>

org.apache.karaf.bundle.core.BundleInfo info = bundleService.getInfo(bundle.get());

info.getState();

More info: https://github.com/apache/karaf/blob/5144a1eba5687dab0f016a9bf95e58e6687a26ad/bundle/core/src/main/java/org/apache/karaf/bundle/command/List.java

Upvotes: 1

Related Questions