Package net.solarnetwork.event
Class SimpleAppEventManager
java.lang.Object
net.solarnetwork.event.SimpleAppEventManager
- All Implemented Interfaces:
AppEventHandlerRegistrar,AppEventPublisher
public class SimpleAppEventManager
extends Object
implements AppEventHandlerRegistrar, AppEventPublisher
Simple implementation of
AppEventHandlerRegistrar.- Since:
- 2.0
- Version:
- 1.0
- Author:
- matt
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.SimpleAppEventManager(Executor executor) Constructor.SimpleAppEventManager(org.springframework.util.PathMatcher pathMatcher, Executor executor) Constructor.SimpleAppEventManager(org.springframework.util.PathMatcher pathMatcher, Executor executor, ConcurrentMap<String, Set<AppEventHandler>> handlerMap) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidderegisterEventHandler(AppEventHandler handler) Deregister a handler from all topics.voidAsynchronously publish an application event.voidregisterEventHandler(AppEventHandler handler, String... topics) Register a handler for a set of topics.
-
Constructor Details
-
SimpleAppEventManager
public SimpleAppEventManager()Constructor.An Ant-style path matcher and work-stealing pool will be used.
-
SimpleAppEventManager
Constructor.An Ant-style path matcher will be used.
- Parameters:
executor- the executor- Throws:
IllegalArgumentException- if any argument is null
-
SimpleAppEventManager
Constructor.- Parameters:
pathMatcher- the path matcher to use for topic matchingexecutor- the executor- Throws:
IllegalArgumentException- if any argument is null
-
SimpleAppEventManager
public SimpleAppEventManager(org.springframework.util.PathMatcher pathMatcher, Executor executor, ConcurrentMap<String, Set<AppEventHandler>> handlerMap) Constructor.- Parameters:
pathMatcher- the path matcher to use for topic matchingexecutor- the executorhandlerMap- the map to use for handler registration- Throws:
IllegalArgumentException- if any argument is null
-
-
Method Details
-
registerEventHandler
Description copied from interface:AppEventHandlerRegistrarRegister a handler for a set of topics.- Specified by:
registerEventHandlerin interfaceAppEventHandlerRegistrar- Parameters:
handler- the handlertopics- the topics to regsiter
-
deregisterEventHandler
Description copied from interface:AppEventHandlerRegistrarDeregister a handler from all topics.- Specified by:
deregisterEventHandlerin interfaceAppEventHandlerRegistrar- Parameters:
handler- the handler to deregister
-
postEvent
Description copied from interface:AppEventPublisherAsynchronously publish an application event.- Specified by:
postEventin interfaceAppEventPublisher- Parameters:
event- the event to publish
-