We’ve encountered an issue with DM Lambda (1.1.1) where a bundle’s stop method is not being called when the bundle is stopped. I have an executable jar that contains a simple example of this issue. The example contains two custom bundles, one is using the standard DM syntax, where stop is being called as expected. The second custom bundle uses the new DM Lambda syntax and the Activator code is included below. This second bundle (org.syntech.examples.dmlambda) does not result in stop being called.
I have to think I’m just missing something obvious, but try as I might, I could not get the DM Lambda enabled bundle’s stop method to be called. Any help or guidance would be appreciated. We really like the new DM Lambda syntax and would like to use it going forward.
Example: simple activator using DM Lambda syntax, which does not call the “stop” method as expected. I’ve tried using the default and specifying the callbacks explicitly, nothing seems to work.
@Override
protected void init(BundleContext ctx, DependencyManager dm) throws Exception {
component(comp -> comp.impl(ExampleServiceUsingDmLambda.class)
.start("start")
.stop("stop")
.provides(ExampleServiceUsingDmLambda.class));
}
Following are the bundle versions contained in example JAR.
____________________________
Welcome to Apache Felix Gogo
g! lb
START LEVEL 1
ID|State |Level|Name
0|Active | 0|System Bundle (5.6.10)|5.6.10
1|Active | 1|osgi.core (6.0.0.201403061837)|6.0.0.201403061837
2|Active | 1|Apache Felix Log Service (1.0.1)|1.0.1
3|Active | 1|Apache Felix Metatype Service (1.1.6)|1.1.6
4|Active | 1|Apache Felix Configuration Admin Service (1.8.16)|1.8.16
5|Active | 1|Apache Felix Dependency Manager (4.4.1)|4.4.1
6|Active | 1|org.apache.felix.dependencymanager.lambda (1.1.1)|1.1.1
7|Active | 1|Apache Felix Gogo Command (1.0.2)|1.0.2
8|Active | 1|Apache Felix Gogo Runtime (1.0.10)|1.0.10
9|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0
10|Active | 1|Apache Felix Remote Shell (1.2.0)|1.2.0
11|Active | 1|Apache Felix Dependency Manager Shell (4.0.6)|4.0.6
12|Active | 1|org.syntech.examples.dmlambda (1.0.0)|1.0.0
13|Active | 1|org.syntech.examples.dmstandard (1.0.0)|1.0.0
I also have an executable JAR and example project I can send that illustrates the issue. Any help or guidance would be appreciated.
Your example seems correct, but there is a bug in the org.apache.felix.dependencymanager.lambda
1.1.1 version.
I just fixed it (see the felix JIRA issue).
I also attached the patch in the jira issue which you can find here.