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.

Upvotes: 0

Views: 153

Answers (1)

Matt Pavlovich
Matt Pavlovich

Reputation: 4316

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

Upvotes: 0

Related Questions