org.xwiki.observation
Class AbstractThreadEventListener

java.lang.Object
  extended by org.xwiki.observation.AbstractThreadEventListener
All Implemented Interfaces:
EventListener
Direct Known Subclasses:
WrappedThreadEventListener

public abstract class AbstractThreadEventListener
extends Object
implements EventListener

Filter events by keeping only events produced by the provided Thread.

Since:
3.2M3

Constructor Summary
AbstractThreadEventListener()
          Use Thread.currentThread().
AbstractThreadEventListener(Thread thread)
           
 
Method Summary
 void onEvent(Event event, Object source, Object data)
          The ObservationManager calls this method when an event matches one of the events for which this listener is registered (see EventListener.getEvents().
protected abstract  void onEventInternal(Event event, Object source, Object data)
          Called when the event has been produce by the proper Thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xwiki.observation.EventListener
getEvents, getName
 

Constructor Detail

AbstractThreadEventListener

public AbstractThreadEventListener()
Use Thread.currentThread().


AbstractThreadEventListener

public AbstractThreadEventListener(Thread thread)
Parameters:
thread - the thread to match to receive events.
Method Detail

onEvent

public void onEvent(Event event,
                    Object source,
                    Object data)
Description copied from interface: EventListener
The ObservationManager calls this method when an event matches one of the events for which this listener is registered (see EventListener.getEvents().

Specified by:
onEvent in interface EventListener
Parameters:
event - the event triggered. Can be used to differentiate different events if your Object supports several events for example.
source - the event source i.e. the object for which the event was triggered. For example this would be the document Object if the event is a document update event.
data - some additional and optional data passed that can be acted on.

onEventInternal

protected abstract void onEventInternal(Event event,
                                        Object source,
                                        Object data)
Called when the event has been produce by the proper Thread.

Parameters:
event - the event triggered. Can be used to differentiate different events if your Object supports several events for example.
source - the event source i.e. the object for which the event was triggered. For example this would be the document Object if the event is a document update event.
data - some additional and optional data passed that can be acted on.