public class EventServiceImpl extends Object implements EventService, EventServiceAdmin, Synchronization
| Modifier and Type | Field and Description |
|---|---|
protected AsyncEventExecutor |
asyncExec |
protected List<AsyncWaitHook> |
asyncWaitHooks |
protected boolean |
blockAsyncProcessing |
protected boolean |
blockSyncPostCommitProcessing |
protected boolean |
bulkModeEnabled |
protected EventDispatcherRegistry |
dispatchers |
protected EventListenerList |
listenerDescriptors |
protected EventBundleDispatcher |
pipeDispatcher |
protected PostCommitEventExecutor |
postCommitExec |
protected EventPipeRegistry |
registeredPipes |
protected static ThreadLocal<org.nuxeo.ecm.core.event.impl.EventServiceImpl.CompositeEventBundle> |
threadBundles |
static VMID |
VMID |
| Constructor and Description |
|---|
EventServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addEventDispatcher(EventDispatcherDescriptor dispatcherDescriptor) |
void |
addEventListener(EventListenerDescriptor listener)
Adds a new event listener.
|
void |
addEventPipe(EventPipeDescriptor pipeDescriptor) |
void |
afterCompletion(int status) |
void |
beforeCompletion() |
void |
fireEvent(Event event)
Fires an event.
|
void |
fireEvent(String name,
EventContext context)
Fires an event given its name and a context.
|
void |
fireEventBundle(EventBundle event)
Fires all recorded events in a transaction.
|
void |
fireEventBundleSync(EventBundle event)
Fires an event bundle in synchronous mode.
|
int |
getActiveThreadsCount() |
EventBundleDispatcher |
getEventBundleDispatcher() |
EventListenerDescriptor |
getEventListener(String name)
Gets the event listener descriptor corresponding to the give name.
|
EventListenerList |
getEventListenerList() |
List<EventListener> |
getEventListeners()
Gets the list of the registered event listeners.
|
int |
getEventsInQueueCount() |
EventListenerList |
getListenerList() |
List<PostCommitEventListener> |
getPostCommitEventListeners()
Get the list of the registered post commit event listeners.
|
protected void |
handleTxCommited() |
protected void |
handleTxRollbacked() |
void |
init() |
boolean |
isBlockAsyncHandlers() |
boolean |
isBlockSyncPostCommitHandlers() |
boolean |
isBulkModeEnabled() |
protected void |
recordEvent(Event event) |
void |
registerForAsyncWait(AsyncWaitHook callback) |
void |
removeEventDispatcher(EventDispatcherDescriptor dispatcherDescriptor) |
void |
removeEventListener(EventListenerDescriptor listener)
Removes an event listener.
|
void |
removeEventPipe(EventPipeDescriptor pipeDescriptor) |
void |
setBlockAsyncHandlers(boolean blockAsyncHandlers) |
void |
setBlockSyncPostCommitHandlers(boolean blockSyncPostComitHandlers) |
void |
setBulkModeEnabled(boolean bulkModeEnabled) |
void |
setListenerEnabledFlag(String listenerName,
boolean enabled) |
void |
shutdown(long timeoutMillis) |
void |
unregisterForAsyncWait(AsyncWaitHook callback) |
void |
waitForAsyncCompletion()
Waits until all asynchronous tasks are finished.
|
void |
waitForAsyncCompletion(long timeout)
Waits until all asynchronous tasks are finished, but waits no longer than the given number of milliseconds.
|
protected static final ThreadLocal<org.nuxeo.ecm.core.event.impl.EventServiceImpl.CompositeEventBundle> threadBundles
protected final EventListenerList listenerDescriptors
protected PostCommitEventExecutor postCommitExec
protected volatile AsyncEventExecutor asyncExec
protected final List<AsyncWaitHook> asyncWaitHooks
protected boolean blockAsyncProcessing
protected boolean blockSyncPostCommitProcessing
protected boolean bulkModeEnabled
protected EventPipeRegistry registeredPipes
protected EventDispatcherRegistry dispatchers
protected EventBundleDispatcher pipeDispatcher
public EventServiceImpl()
public void init()
public EventBundleDispatcher getEventBundleDispatcher()
public void shutdown(long timeoutMillis) throws InterruptedException
InterruptedExceptionpublic void registerForAsyncWait(AsyncWaitHook callback)
public void unregisterForAsyncWait(AsyncWaitHook callback)
public void waitForAsyncCompletion()
EventServicewaitForAsyncCompletion in interface EventServicepublic void waitForAsyncCompletion(long timeout)
EventServicewaitForAsyncCompletion in interface EventServicetimeout - the maximum time to wait for, in millisecondspublic void addEventListener(EventListenerDescriptor listener)
EventService
The event listener is described by a EventListenerDescriptor that may specify a priority. Both types of
listeners (immediate and post-commit) are registered.
addEventListener in interface EventServicelistener - the listener to addpublic void addEventPipe(EventPipeDescriptor pipeDescriptor)
public void addEventDispatcher(EventDispatcherDescriptor dispatcherDescriptor)
public void removeEventListener(EventListenerDescriptor listener)
EventServiceremoveEventListener in interface EventServicelistener - the listener to removepublic void removeEventPipe(EventPipeDescriptor pipeDescriptor)
public void removeEventDispatcher(EventDispatcherDescriptor dispatcherDescriptor)
public void fireEvent(String name, EventContext context)
EventServicefireEvent in interface EventServicename - the event namecontext - the event contextpublic void fireEvent(Event event)
EventServiceIf a transaction was started, the event is registered if needed to be sent after the transaction commit.
fireEvent in interface EventProducerfireEvent in interface EventServiceevent - the event to firepublic void fireEventBundle(EventBundle event)
EventService
The events are fired to PostCommitEventListener listeners. Events are fired in the form of an event
bundle.
fireEventBundle in interface EventProducerfireEventBundle in interface EventServiceevent - the event bundlepublic void fireEventBundleSync(EventBundle event)
EventServiceThis means that asynchronous listeners will be run synchronously.
fireEventBundleSync in interface EventServicepublic List<EventListener> getEventListeners()
EventService
Modification on this list will not modify the internal lists in this EventService.
getEventListeners in interface EventServicepublic List<PostCommitEventListener> getPostCommitEventListeners()
EventService
Modification on this list will not modify the internal lists in this EventService.
getPostCommitEventListeners in interface EventServicepublic EventListenerList getEventListenerList()
public EventListenerDescriptor getEventListener(String name)
EventServicegetEventListener in interface EventServicename - the event listener namenull if not foundpublic EventListenerList getListenerList()
getListenerList in interface EventServiceAdminpublic void setListenerEnabledFlag(String listenerName, boolean enabled)
setListenerEnabledFlag in interface EventServiceAdminpublic int getActiveThreadsCount()
getActiveThreadsCount in interface EventServiceAdminpublic int getEventsInQueueCount()
getEventsInQueueCount in interface EventServiceAdminpublic boolean isBlockAsyncHandlers()
isBlockAsyncHandlers in interface EventServiceAdminpublic boolean isBlockSyncPostCommitHandlers()
isBlockSyncPostCommitHandlers in interface EventServiceAdminpublic void setBlockAsyncHandlers(boolean blockAsyncHandlers)
setBlockAsyncHandlers in interface EventServiceAdminpublic void setBlockSyncPostCommitHandlers(boolean blockSyncPostComitHandlers)
setBlockSyncPostCommitHandlers in interface EventServiceAdminpublic boolean isBulkModeEnabled()
isBulkModeEnabled in interface EventServiceAdminpublic void setBulkModeEnabled(boolean bulkModeEnabled)
setBulkModeEnabled in interface EventServiceAdminprotected void recordEvent(Event event)
public void beforeCompletion()
beforeCompletion in interface Synchronizationpublic void afterCompletion(int status)
afterCompletion in interface Synchronizationprotected void handleTxRollbacked()
protected void handleTxCommited()
Copyright © 2019 Nuxeo. All rights reserved.