'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.



Solution 1:[1]

Look into using EventHandler (or perhaps BundleTracker depending on your use case). OSGi defines a FrameworkEvent that an EventHandler will receive. You could configure your second stage to trigger based on the 'STARTED' event.

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

alternatively: org.osgi.util.tracker.BundleTracker

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matt Pavlovich