简体   繁体   English

如何让 Bundle Activator 实例在所有 bundle 都被激活后调用一个方法

[英]How to get Bundle Activator Instance to call a method after all bundles are activated

I need to call a method with bundle activator instance after every bundle is started.我需要在每个包启动后调用一个带有包激活器实例的方法。 I have five bundles.我有五个包。 How do I get the bundle activator instance?如何获取捆绑激活器实例? Requirement: Call a method only with the activator instance.要求:仅使用激活器实例调用方法。

Look into using EventHandler (or perhaps BundleTracker depending on your use case).考虑使用 EventHandler(或者 BundleTracker,具体取决于您的用例)。 OSGi defines a FrameworkEvent that an EventHandler will receive. OSGi 定义了 EventHandler 将接收的 FrameworkEvent。 You could configure your second stage to trigger based on the 'STARTED' event.您可以将第二阶段配置为根据“开始”事件触发。

  • org.osgi.service.event.EventHandler org.osgi.service.event.EventHandler
  • org.osgi.framework.FrameworkEvent org.osgi.framework.FrameworkEvent

alternatively: org.osgi.util.tracker.BundleTracker或者:org.osgi.util.tracker.BundleTracker

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 插入Bundle Activator后,OSGi包无法启动 - OSGi bundle doesn't start after inserting a Bundle Activator 如何在Maven-bundle-plugin中包含源包 - How to include source bundles with maven-bundle-plugin 如何捆绑使用多个捆绑包的自定义 NiFi 处理器? - How to bundle custom NiFi processor which uses multiple bundles? 将Bundle-A jar文件安装到OSGi容器后,如何调用其中一个方法 - How to call one of the methods in my Bundle-A jar file after it has been installed into OSGi container 如何在多模块项目中列出mvn中所有激活的配置文件 - How to list all activated profiles in mvn in a multimodule project 在同一实例上访问CQ5项目捆绑 - Access CQ5 project bundles on same instance 在所有测试之后如何调用自定义方法/ cleanUp? (Geb和Spock) - How to invoke a custom method/cleanUp after all tests? (Geb and Spock) 将ServletContainerInitializers从不同的包打包到单个OSGi包中 - Pack ServletContainerInitializers from different bundles to a single OSGi bundle 如何在Eclipse上链接OSGI包? - How to link OSGI bundles on eclipse? 如何在不打开或导入Eclipse中依赖包的情况下开发OSGi包? - How to develop OSGi bundles without opening or importing the dependent bundles in Eclipse?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM