Class FastEvent<T>

  • Type Parameters:
    T - event type

    public class FastEvent<T>
    extends Object
    An optimized internal facility for dispatching events.

    FastEvent eliminates most of the overhead associated with request dispatching by resolving observer methods upfront. It is therefore suitable for cases when certain event is dispatched repeatedly. A FastEvent instance should be created once for a given event type / qualifiers combination and then reused every time a given event is dispatched.

    FastEvent provides a subset of functionality provided by Event and these additional constraints apply to its usage:

    • Event type and qualifiers must be known at FastEvent construction time. The actual type of the event object passed to the fire(Object) method is not considered for observer method resolution.
    • Events dispatched using FastEvent are always delivered immediately. If an observer method is transactional it will not be notified
    • FastEvent is not serializable

    These constraints should always be carefully considered when deciding whether to use FastEvent or not. FastEvent is an internal construct and should not be used by an application.

    Author:
    Jozef Hartinger