Hi Andreas,

Service events are always sent synchronously to listeners and trackers. This is 
required by the specification, and not up to the framework implementation. The 
side effects of this are as follows:

If two services are registered on different threads then the listener may 
receive those two events simultaneously
If as a result of receiving an event a service listener 
registers/unregisters/updates a service then that new service event will be 
delivered to service listeners *before* the original event can propagate 
further. This will also cause the thread to re-enter the original service 
listener.

To answer your question, once the call to BundleContext#registerService() has 
returned then all listeners will have been notified of the EventHandler. This 
will mean that EventAdmin is ready if (and only if) it was already started and 
listening for handlers, and that the EventAdmin implementation uses service 
event to register the EventHandler, which it almost certainly does.

Regards,

Tim


On 21 Aug 2014, at 12:04, Andreas Klotz <[email protected]> wrote:

> 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
>  
> <Mail Attachment.png>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
> 
> <Mail Attachment.png>Wie wäre es mit „n-design zum Mitmachen“? Besuchen Sie 
> unseren spannenden Blog. Wir freuen uns auf Ihre Kommentare!
> 
> <Mail Attachment.jpeg>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

Reply via email to