|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfulmine.AbstractLifeCycle
fulmine.event.listener.ActiveEventListener
public final class ActiveEventListener
An active event listener implementation that uses an internal
EventProcessor to execute the update logic. This is a wrapper
listener for a delegate IEventListener. Any listener can be made
active simply by wrapping it with this.
The active listener separates the processing of the listener
update(IEvent) method from the context EventProcessor. This
is only required where there is heavy-weight or thread blocking operations in
the update processing.
| Constructor Summary | |
|---|---|
ActiveEventListener(IFulmineContext context,
IEventListener delegate)
Wraps a delegate IEventListener and pushes all events into the
delegate using an internal EventProcessor. |
|
ActiveEventListener(IFulmineContext context,
String name,
IEventListener delegate)
Wraps a delegate IEventListener and pushes all events into the
delegate using an internal EventProcessor. |
|
| Method Summary | |
|---|---|
void |
addedAsListenerFor(IEventSource source)
The listener receives this when it has been added as a listener to an event source via IEventSource.addListener(IEventListener). |
protected void |
doDestroy()
Destroy the internal EventProcessor |
protected void |
doStart()
Overridden in subclasses to perform custom logic on activation. |
Class<? extends IEvent>[] |
getEventTypeFilter()
Get the classes of IEvent instances this listener can process. |
protected AsyncLog |
getLog()
Get the log to use for the object hierarchy |
void |
removedAsListenerFrom(IEventSource source)
The listener receives this when it has been removed as a listener from an event source via IEventSource.removeListener(IEventListener). |
String |
toString()
|
void |
update(IEvent event)
Add the event to the event processor's event queue. |
| Methods inherited from class fulmine.AbstractLifeCycle |
|---|
checkActive, destroy, finalize, isActive, start |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface fulmine.ILifeCycle |
|---|
isActive, start |
| Methods inherited from interface fulmine.IDestroyable |
|---|
destroy |
| Constructor Detail |
|---|
public ActiveEventListener(IFulmineContext context,
IEventListener delegate)
IEventListener and pushes all events into the
delegate using an internal EventProcessor.
context - the context this listener should usedelegate - the delegate event listener
public ActiveEventListener(IFulmineContext context,
String name,
IEventListener delegate)
IEventListener and pushes all events into the
delegate using an internal EventProcessor.
context - the context this listener should usename - the name for the internal EventProcessordelegate - the delegate event listener| Method Detail |
|---|
public void update(IEvent event)
update in interface IEventListenerevent - the event encapsulating the update.IEventListener.update(IEvent)public void addedAsListenerFor(IEventSource source)
IEventListenerIEventSource.addListener(IEventListener).
addedAsListenerFor in interface IEventListenersource - the source that this listener will receive events from.public void removedAsListenerFrom(IEventSource source)
IEventListenerIEventSource.removeListener(IEventListener).
removedAsListenerFrom in interface IEventListenersource - the source that this listener will no longer receive events
from.public Class<? extends IEvent>[] getEventTypeFilter()
IEventListenerIEvent instances this listener can process.
The IEventListener.update(IEvent) method will only be called with
IEvent instances whose Class is assignment
compatible with any contained in this array.
This is an event filtering mechanism. An IEventSource may
generate many types of IEvent instances but a listener may only
be interested in one type. By specifying the types of events the listener
is interested in using this method, the listener effectively filters out
unwanted events.
If the filter is dynamic then this method must be thread aware.
getEventTypeFilter in interface IEventListenerClass objects that determine the types of
IEvent instances this listener can processprotected AsyncLog getLog()
AbstractLifeCycle
getLog in class AbstractLifeCycleprotected void doDestroy()
EventProcessor
doDestroy in class AbstractLifeCycleprotected void doStart()
AbstractLifeCycleRuntimeException or subclass
thereof. When this method is called, the AbstractLifeCycle.isActive() method will
return true.
doStart in class AbstractLifeCyclepublic String toString()
toString in class AbstractLifeCycle
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||