Java OSGi应用程序修补机制
是否有推荐的方法在运行时修补OSGi应用程序?我正在使用OSGi的equinox实现 如果我停止某个包并安装修补包。在运行时它将如何影响其他bundle 我看到了这一点,但它没有给出明确的答案Java OSGi应用程序修补机制,java,osgi,osgi-bundle,Java,Osgi,Osgi Bundle,是否有推荐的方法在运行时修补OSGi应用程序?我正在使用OSGi的equinox实现 如果我停止某个包并安装修补包。在运行时它将如何影响其他bundle 我看到了这一点,但它没有给出明确的答案 谢谢。我想这取决于捆绑包有多好 在第73页的《OSGi在行动》一书中有一个很好的例子 要亲自尝试: 下载 解压缩文件并使用Ant(osgi-in-action/chapter03/build.xml)构建“chapter03”示例 将chapter03/paint example/bundles/*-3.
谢谢。我想这取决于捆绑包有多好 在第73页的《OSGi在行动》一书中有一个很好的例子 要亲自尝试:
osgi-in-action/chapter03/build.xml
)构建“chapter03”示例chapter03/paint example/bundles/*-3.0.jar
文件复制到例如chapter03/shell example/1
org.apache.felix.main.distribution-4.2.1.zip
文件felix-framework-4.2.1/bin/felix.jar
文件default.properties
文件复制到OSGi示例的chapter03/shell示例/launcher.jar
中// In console window #1:
$ cd chapter03/shell-example/
$ java -jar launcher.jar bundles
// In console window #2:
$ telnet localhost 7070
-> install file:1/paint-3.0.jar
-> install file:1/shape-3.0.jar
-> start 2
-> install file:1/circle-3.0.jar
-> install file:1/square-3.0.jar
-> start 4
-> start 5
-> install file:1/triangle-3.0.jar
-> start 6
// You can now draw all three shapes.
// Simulate upgrade/patch of "circle" bundle:
-> stop 4
// A "work in progress" sign is in place of the circles.
// You can still move them.
// Start the "circle" bundle again and they're back in the UI:
-> start 4
您可以查看示例源代码以了解他们是如何做到这一点的。
我希望这能回答您的问题。这部分取决于捆绑包是使用服务还是使用导入/导出的包。服务更具活力 如果补丁类作为导出包使用,则其使用者将拥有对原始类的引用。要强制移动到新实例,必须在控制台中或直接在“FrameworkWiring”实例上调用。(现在称为“refreshBundles”,但原理类似。) 在一个密切相关的问题中进行了充分的讨论