Skip to content

A thread safe implementation of the Event Bus pattern with a few neat features.

Notifications You must be signed in to change notification settings

jongillham/EventManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

 * This acts as a controller for firing events. For example if we have the
 * following <code>Event</code> object heirachy:
 *
 * <pre>
 *         ClientEvent extends Event
 *         LoginEvent extends ClientEvent
 *         LogoutEvent extends ClientEvent
 * </pre>
 *
 * Then add the following <code>EventListener</code> to the
 * <code>EventManager</code>:
 *
 * <pre>
 * addListener(LoginEvent.class, new EventListener() {
 * 	public void eventFired(Event e) {
 * 		System.out.println(e.getClass().getName());
 * 	}
 * });
 * </pre>
 *
 * The event listener will only be called when <code>fireEvent</code> fires a
 * new <code>LoginEvent</code> and the output will always be 'LoginEvent'.
 * However if we made the listener listen for
 * <code>addListener(ClientEvent.class,</code>... the event listener will be
 * called for every <code>LoginEvent</code>, <code>LogoutEvent</code> and
 * <code>ClientEvent</code> making the output either 'LoginEvent',
 * 'LogoutEvent' or 'ClientEvent'. Ideally each <code>Event</code> subclass
 * should be immutable so that all event listeners are guaranteed to receive the
 * same state.

About

A thread safe implementation of the Event Bus pattern with a few neat features.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published