Class AsyncDispatcher<K,​V>


  • public class AsyncDispatcher<K,​V>
    extends Object
    Calls the listeners with help of the executor. The dispatcher is designed to achieve maximum parallelism but deliver events for one key in the correct order.

    General principle: Before a listener is called a queue is created for the specific key. In the queue all following events will be enqueued in case the listener isn't finished yet.

    Rationale: We get get called with a new event synchronously and then do the async dispatching. This means we need to be careful not to introduce contention in the synchronous listener execution of the cache. Alternatively we could just have add the event to a queue and then do the more complex dispatching logic in a separate thread, however, that means that we would need an additional thread per cache.

    Author:
    Jens Wilke
    • Constructor Detail

      • AsyncDispatcher

        public AsyncDispatcher​(Executor executor)