com.stuffthathappens.classbus
Interface DeliveryStrategy

All Known Implementing Classes:
EdtDeliveryStrategy, SyncDeliveryStrategy

public interface DeliveryStrategy

Delivers events to recipients, either in the caller thread or by spawning new threads.

Author:
Eric M. Burke

Method Summary
<T> void
publishTo(java.lang.Iterable<EventSubscriber<T>> subscribers, T event, DeliveryCompleteCallback<T> callback)
          Iterate over the given collection of subscribers, calling EventSubscriber.onEvent(Object) on each subscriber.
 

Method Detail

publishTo

<T> void publishTo(java.lang.Iterable<EventSubscriber<T>> subscribers,
                   T event,
                   DeliveryCompleteCallback<T> callback)
Iterate over the given collection of subscribers, calling EventSubscriber.onEvent(Object) on each subscriber. This may spawn a new thread, depending on the implementation.

The callback is optional. If null, it is ignored.

Parameters:
subscribers - the subscribers to notify.
event - the object to send.
callback - an optional callback to notify upon completion.
See Also:
EventSubscriber.onEvent(Object)