5.1. Event Handling

The OSGi event types and event listeners follow the event model introduced in JDK software version 1.x. There are three types of events, and their event classes are defined in the org.osgi.framework package:

  1. FrameworkEvent. A framework event occurs when the framework is launched or an error has occurred asynchronously during execution of the framework.

  2. BundleEvent. A bundle event occurs after a bundle life cycle action takes place.

  3. ServiceEvent. A service event occurs in response to a service registration, unregistration, or property change.

A named constant is used to identify further a condition in one of the three event types. For example, BundleEvent.STARTED indicates the bundle event of a bundle that has been activated. ...

Get Programming Open Service Gateways with Java Embedded Server™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.