You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Bree Van Oss <Br...@myfuelmaster.com> on 2018/01/05 18:38:26 UTC

DM Lambda "stop" not being called

Hello,

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 a simple project and executable jar that contains an example of this issue in two bundles, one using the standard DM syntax, where stop is being called as expected and a second that 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

 Any help or guidance would be appreciated.

I have also posted this to Stackoverflow. https://stackoverflow.com/questions/48100733/apache-felix-stop-method-is-not-called-when-using-dmlambda

Thanks,
Bree


Re: DM Lambda "stop" not being called

Posted by Pierre De Rop <pi...@gmail.com>.
Hello Bree;

Sorry for the late response, I was on vacation.

So, your example is definitely correct, but unfortunately, you came across
a bug which I just fixed using the FELIX-5768
<https://issues.apache.org/jira/browse/FELIX-5768> jira issue.
Sorry about this silly problem, I did not see this basic issue because
there were no integration tests for it, but I just added one.

I will make a new release at the end of this week. In the meantime, if you
want, you can download the patch from here:
https://issues.apache.org/jira/secure/attachment/12905001/org.apache.felix.dependencymanager.lambda-1.1.2.jar
(you can also download it from the FELIX-5768
<https://issues.apache.org/jira/browse/FELIX-5768> jira issue).

Please replace the old org.apache.felix.dependencymanager.lambda-1.1.1.jar
bundle with the new 1.1.2 version from the above link, it should now be ok.

thanks & kind regards
Pierre


On Fri, Jan 5, 2018 at 7:38 PM, Bree Van Oss <Br...@myfuelmaster.com>
wrote:

> Hello,
>
> 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 a simple
> project and executable jar that contains an example of this issue in two
> bundles, one using the standard DM syntax, where stop is being called as
> expected and a second that 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
>
>  Any help or guidance would be appreciated.
>
> I have also posted this to Stackoverflow. https://stackoverflow.com/
> questions/48100733/apache-felix-stop-method-is-not-
> called-when-using-dmlambda
>
> Thanks,
> Bree
>
>