On Tue, Jun 15, 2010 at 8:20 AM, Carsten Ziegeler <[email protected]> wrote: > Lucas Galfaso wrote >> 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. >> > Right, therefore the spec defines only the event delivery of a single > thread. > Events from the same thread have to be delivered in the order they have > been sent - regardless of async or sync delivery. > So if you have one single thread sending events, your event handler will > never be called multi threaded (except your handler sends an event > during the event handling of another event maybe). > > As soon as more than one thread is sending "everything" can happen which > means it depends on the implementation of the event admin. The older > event admin implementation 1.0 of Apache Felix for example did queue all > events. In this case even in a multi threaded environment events are > sent one after the other.
Iirc, that was a requirement of the old version of the spec. In 4.2 it has been changed so that we can do what we are doing now. regards, Karl > The latest Apache Felix Event Admin is faster and sends events in parallel. > > > HTH > Carsten > -- > Carsten Ziegeler > [email protected] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Karl Pauls [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

