Package org.apache.cayenne.event
Class NoopEventManager
java.lang.Object
org.apache.cayenne.event.NoopEventManager
- All Implemented Interfaces:
EventManager
- Since:
- 4.1
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(Object listener, String methodName, Class<?> eventParameterClass, EventSubject subject) Register anEventListener
for events sent by any sender.void
addListener
(Object listener, String methodName, Class<?> eventParameterClass, EventSubject subject, Object sender) Register anEventListener
for events sent by a specific sender.void
addNonBlockingListener
(Object listener, String methodName, Class<?> eventParameterClass, EventSubject subject) void
addNonBlockingListener
(Object listener, String methodName, Class<?> eventParameterClass, EventSubject subject, Object sender) boolean
Returns true if this EventManager is single-threaded.void
postEvent
(EventObject event, EventSubject subject) Sends an event to all registered objects about a particular subject.void
postNonBlockingEvent
(EventObject event, EventSubject subject) Sends an event to all registered objects about a particular subject.boolean
removeAllListeners
(EventSubject subject) Removes all listeners for a given subject.boolean
removeListener
(Object listener) Unregister the specified listener from all event subjects handled by this manager instance.boolean
removeListener
(Object listener, EventSubject subject) Unregister the specified listener for the events about the given subject.boolean
removeListener
(Object listener, EventSubject subject, Object sender) Unregister the specified listener for the events about the given subject and the given sender.
-
Constructor Details
-
NoopEventManager
public NoopEventManager()
-
-
Method Details
-
isSingleThreaded
public boolean isSingleThreaded()Description copied from interface:EventManager
Returns true if this EventManager is single-threaded. If so it will throw an exception on any attempt to register an unblocking listener or dispatch a non-blocking event.- Specified by:
isSingleThreaded
in interfaceEventManager
-
addListener
public void addListener(Object listener, String methodName, Class<?> eventParameterClass, EventSubject subject) Description copied from interface:EventManager
Register anEventListener
for events sent by any sender.- Specified by:
addListener
in interfaceEventManager
-
addNonBlockingListener
public void addNonBlockingListener(Object listener, String methodName, Class<?> eventParameterClass, EventSubject subject) - Specified by:
addNonBlockingListener
in interfaceEventManager
-
addListener
public void addListener(Object listener, String methodName, Class<?> eventParameterClass, EventSubject subject, Object sender) Description copied from interface:EventManager
Register anEventListener
for events sent by a specific sender.- Specified by:
addListener
in interfaceEventManager
- Parameters:
listener
- the object to be notified about eventsmethodName
- the name of the listener method to be invokedeventParameterClass
- the class of the single event argument passed tomethodName
subject
- the event subject that the listener is interested insender
- the object whose events the listener is interested in;null
means 'any sender'.
-
addNonBlockingListener
public void addNonBlockingListener(Object listener, String methodName, Class<?> eventParameterClass, EventSubject subject, Object sender) - Specified by:
addNonBlockingListener
in interfaceEventManager
-
removeListener
Description copied from interface:EventManager
Unregister the specified listener from all event subjects handled by this manager instance.- Specified by:
removeListener
in interfaceEventManager
- Parameters:
listener
- the object to be unregistered- Returns:
true
iflistener
could be removed for any existing subjects, else returnsfalse
.
-
removeAllListeners
Description copied from interface:EventManager
Removes all listeners for a given subject.- Specified by:
removeAllListeners
in interfaceEventManager
-
removeListener
Description copied from interface:EventManager
Unregister the specified listener for the events about the given subject.- Specified by:
removeListener
in interfaceEventManager
- Parameters:
listener
- the object to be unregisteredsubject
- the subject from which the listener is to be unregistered- Returns:
true
iflistener
could be removed for the given subject, else returnsfalse
.
-
removeListener
Description copied from interface:EventManager
Unregister the specified listener for the events about the given subject and the given sender.- Specified by:
removeListener
in interfaceEventManager
- Parameters:
listener
- the object to be unregisteredsubject
- the subject from which the listener is to be unregisteredsender
- the object whose events the listener was interested in;null
means 'any sender'.- Returns:
true
iflistener
could be removed for the given subject, else returnsfalse
.
-
postEvent
Description copied from interface:EventManager
Sends an event to all registered objects about a particular subject. Event is sent synchronously, so the sender thread is blocked until all the listeners finish processing the event.- Specified by:
postEvent
in interfaceEventManager
- Parameters:
event
- the event to be posted to the observerssubject
- the subject about which observers will be notified
-
postNonBlockingEvent
Description copied from interface:EventManager
Sends an event to all registered objects about a particular subject. Event is queued by EventManager, releasing the sender thread, and is later dispatched in a separate thread.- Specified by:
postNonBlockingEvent
in interfaceEventManager
- Parameters:
event
- the event to be posted to the observerssubject
- the subject about which observers will be notified
-