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

124 Views Asked by At

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.

1

There are 1 best solutions below

10
Matt Pavlovich On

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