Wednesday, November 10, 2010

OSGi Whiteboard Pattern

Explanation of Whiteboard pattern and comparison with classic Listener pattern: http://www.osgi.org/wiki/uploads/Links/whiteboard.pdf.


The whiteboard pattern leverages the OSGi framework’s service registry instead of implementing a private registry as required by the listener pattern. Instead of having event listeners track event sources and then register themselves with the event source, the whiteboard pattern has event listeners register themselves as a service with the OSGi framework. When the event source has an event object to deliver, the event source calls all event listeners in the service registry.
Remarkably, the event source is not registered with the framework as a service. This makes bundles using the whiteboard pattern significantly smaller and easier to implement. The inter-bundle dependency between the event source and the event listener is handled by the framework and requires almost no code in the event source and event listener bundles.

No comments:

Post a Comment