Hi, Thanks Niclas and BJ for your input.
BJ Hargrave schrieb: > >> Hi all, >> >> In our application we noticed, that on each invocation of a >> LogService.log method the log event is immediately handled by the >> EventAdmin to post the Event asynchronously. This means, that the >> EventAdmin EventHandler list for the log event is evaluated during the >> call to the LogService.log method. The problem is, that this evaluation >> may block the LogService.log call, which should IMHO return as fast as >> possible. > > It seems the LogService implementation is not following the advice of > 101.4 of the spec: > > "The delivery of LogEntry objects to the LogListener object should be done > asynchronously. " > > It seems that if this is fixed, all the other issues go away? Oh, I missed that one. Good point. Yes, I assume, this would fix the problems and also indirectly adhere to 101.6.4 with respect to asynchronous hand over to the EventAdmin. > >> >> The concrete implementation of the LogService is the Apache Sling Log >> Bundle, which does not call the EventAdmin itself but only calls the >> registered LogListeners. The implementation of the EventAdmin Service is >> the Apache Felix EventAdmin which in turn registers a LogListener to get >> log events and calls EventAdmin.post to send them to registered handlers >> asynchronosly. >> >> According to Section 101.6.4, Log Events, of the compendium spec, the >> interaction with EventAdmin is stated as "Log events must be delivered >> to the Event Admin service asynchronously". > > There is implementation flexibility in how the LogEvents are delivered > to EventAdmin. One can put that in the LogService impl, in the > EventAdmin impl or in a 3rd bridging bundle which handles the interaction. > > In your case, you have the EventAdmin register a LogListener. Since the > LogService spec only suggests that Log Entries be delivered async, Event > Admin cannot be guaranteed of that. So the impl of LogListener in > EventAdmin should probably assume it is being delivered sync and > "convert" it to async by async making the call to EventAdmin.post. yep. For stability and performance this would probably best. > >> >> According to Section 113.7.2, Asynchronous Event Delivery, asynchronous >> events are delivered asynchronously but the list of handlers has to be >> built during the call to the EventAdmin.post method. >> >> My interpretation of Section 101.6.4 is, that the EventAdmin.post or >> EventAdmin.send method must not be called during the LogService.log call >> but asynchronously, i.e. in a separate thread. On the other hand it is >> not stated whether the event should be delivered asynchronously or >> synchronously from this separate thread. >> > > I think the intention is that post is used to send the event. Makes sense. Regards Felix _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
