Service events are synchronous. Each implementation must deliver them to ServiceListeners synchronously. ServiceTracker is implemented on top of ServiceListener so the customizers of a ServiceTracker get notified synchronously of ongoing service events.
The wording about out of order events is because a ServiceListener X may change the state/properties of a service synchronously while it is processing an event. This in turn fires more service events on the same thread (in a recursive manner). Any ServiceListeners (Y and Z) that are 'after' ServiceListener X will receive these recursive events in a reverse order. Your question about EventAdmin is up to the implementation of EventAdmin, but a typical implementation should process the EventHandlers in a sychronous manner But keep in mind if there are multiple thread involved there will always be a race between EventHandler registration and firing events with EventAdmin. Tom From: Andreas Klotz <[email protected]> To: OSGi Developer Mail List <[email protected]> Date: 08/21/2014 06:04 AM Subject: [osgi-dev] ServiceListener called synchronously or asynchronously? Sent by: [email protected] Hi all, I’d like to know if ServiceListeners/ServiceTracker are called synchronously called during the service registration process. The specification says (10.1.26): “When a ServiceEvent is fired, it is synchronously delivered to a ServiceListener. The Framework may deliver ServiceEvent objects to a ServiceListener out of order and may concurrently call and/or reenter a ServiceListener.” So the decision how to deliver events is up to the implementation? In my use case I register an EventHandler as a service. I need to know when the registration method terminates if the EventHandler is already tracked by the EventAdmin and is ready to receive Events. Thanks and best regards, Andreas -- phone: +49 221 222896 - 24 fax: +49 221 222896 - 11 email: [email protected] n - d e s i g n G m b H www.n-design.de Alpenerstr. 16 D-50825 Köln Amtsgericht Köln HRB 33766 B Geschäftsführer Andy Kohl Verpassen Sie zukünftig keine wichtigen Neuigkeiten mehr zum Thema Softwareentwicklung, moderne Technologien und eHealth sowie zu unserem Unternehmen n-design! Der kostenlose vierteljährliche n-design Newsletter informiert Sie! Zum Anmeldeformular Wie wäre es mit „n-design zum Mitmachen“? Besuchen Sie unseren spannenden Blog. Wir freuen uns auf Ihre Kommentare! Vernetzen Sie sich noch heute mit uns auf XING! _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
