This was my understanding, but reading <quote> 113.7.2 Asynchronous Event Delivery ... The Event Admin service can use more than one thread to deliver events. If it does then it must guarantee that each handler receives the events in the same order as the events were posted. This ensures that handlers see events in the expected order. For example, it would be an error to see a destroyed event before the corresponding created event. ... The Event Admin service ensures that events are delivered in a well-defined order. For example, if a thread posts events A and B in the same thread then the handlers should not receive them in the order B, A. if A and B are posted by different threads at about the same time then no guarantees about the order of delivery are made. </quote>
What is the difference between not sending the events in the order they are created and using two threads to send the two events with minimal time difference? At the end of the day, if two threads are used, then any "reasonable" logic of the second event may have to be processed before the logic of the first event as nothing warrantees what thread will be executed first. Regards, Lucas On Mon, Jun 14, 2010 at 6:49 AM, Peter Kriens <[email protected]> wrote: > Any service by definition must be thread safe or it will fail ... guaranteed. > There is no way to control what thread will call a service at what time in > OSGi. > > Kind regards, > > Peter Kriens > > > > > > On 14 jun 2010, at 08:06, Carsten Ziegeler wrote: > >> Lucas Galfaso wrote >>> Hi All, >>> I am trying to figure out how EventAdmin actually works. Is it >>> possible for an EventAdmin implementation to call an >>> EventHandler::handleEvent while this handler is processing another >>> event by another thread? Is this different if the event is synchronous >>> or asynchronous? And if the event that is waiting to be processed was >>> triggered by the same EventHandler? >>> >> Hi, >> >> afaik this is not explicitly stated in the spec, but I think an >> EventHandler should expect to be called in parallel. For example, this >> can happen if two threads send an event with the same topic in parallel. >> So an event handler implementation should be thread safe. >> >> As soon as you make any assumptions like "this only happens with async >> events" or whatever, you're tying yourself to some characteristics of a >> specific implementation of the event admin. Therefore just asume that i >> can happen and you're safe >> >> Carsten >> -- >> Carsten Ziegeler >> [email protected] >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

