2

我们遇到了 DM Lambda (1.1.1) 的问题,即在停止捆绑包时未调用捆绑包的停止方法。我有一个包含此问题的简单示例的可执行 jar。该示例包含两个自定义包,一个使用标准 DM 语法,其中 stop 被按预期调用。第二个自定义捆绑包使用新的 DM Lambda 语法,激活器代码包含在下面。第二个包 (org.syntech.examples.dmlambda) 不会导致停止调用。

我不得不认为我只是遗漏了一些明显的东西,但是尽我所能,我无法调用启用 DM Lambda 的捆绑包的 stop 方法。任何帮助或指导将不胜感激。我们非常喜欢新的 DM Lambda 语法,并希望继续使用它。

示例:使用 DM Lambda 语法的简单激活器,它不会按预期调用“停止”方法。我尝试使用默认值并明确指定回调,似乎没有任何效果。

@Override
protected void init(BundleContext ctx, DependencyManager dm) throws Exception {
    component(comp -> comp.impl(ExampleServiceUsingDmLambda.class)
            .start("start")
            .stop("stop")
            .provides(ExampleServiceUsingDmLambda.class));
}

以下是示例 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

我还有一个可执行的 JAR 和可以发送的示例项目来说明这个问题。任何帮助或指导将不胜感激。

4

1 回答 1

1

您的示例似乎正确,但org.apache.felix.dependencymanager.lambda1.1.1 版本中存在错误。

我刚刚修复了它(请参阅 felix JIRA 问题)。

我还在 jira 问题中附加了补丁,您可以在此处找到。

于 2018-01-07T23:57:22.857 回答