public class EventServiceImpl extends Object implements EventService, EventServiceAdmin, Synchronization
Constructor and Description |
---|
EventServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(EventListenerDescriptor listener)
Adds a new event listener.
|
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 |
getActiveAsyncTaskCount()
Deprecated.
use
waitForAsyncCompletion() instead. |
int |
getActiveThreadsCount() |
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.
|
void |
init() |
boolean |
isBlockAsyncHandlers() |
boolean |
isBlockSyncPostCommitHandlers() |
boolean |
isBulkModeEnabled() |
void |
registerForAsyncWait(AsyncWaitHook callback) |
void |
removeEventListener(EventListenerDescriptor listener)
Removes an event listener.
|
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.
|
public static final VMID VMID
public void init()
public void shutdown(long timeoutMillis) throws InterruptedException
InterruptedException
public void registerForAsyncWait(AsyncWaitHook callback)
public void unregisterForAsyncWait(AsyncWaitHook callback)
@Deprecated public int getActiveAsyncTaskCount()
waitForAsyncCompletion()
instead.public void waitForAsyncCompletion()
EventService
waitForAsyncCompletion
in interface EventService
public void waitForAsyncCompletion(long timeout)
EventService
waitForAsyncCompletion
in interface EventService
timeout
- 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 EventService
listener
- the listener to addpublic void removeEventListener(EventListenerDescriptor listener)
EventService
removeEventListener
in interface EventService
listener
- the listener to removepublic void fireEvent(String name, EventContext context) throws ClientException
EventService
fireEvent
in interface EventService
name
- the event namecontext
- the event contextClientException
public void fireEvent(Event event) throws ClientException
EventService
If a transaction was started, the event is registered if needed to be sent after the transaction commit.
fireEvent
in interface EventProducer
fireEvent
in interface EventService
event
- the event to fireClientException
public void fireEventBundle(EventBundle event) throws ClientException
EventService
The events are fired to PostCommitEventListener
listeners. Events are fired in the form of an event
bundle.
fireEventBundle
in interface EventProducer
fireEventBundle
in interface EventService
event
- the event bundleClientException
public void fireEventBundleSync(EventBundle event) throws ClientException
EventService
This means that asynchronous listeners will be run synchronously.
fireEventBundleSync
in interface EventService
ClientException
public List<EventListener> getEventListeners()
EventService
Modification on this list will not modify the internal lists in this EventService
.
getEventListeners
in interface EventService
public List<PostCommitEventListener> getPostCommitEventListeners()
EventService
Modification on this list will not modify the internal lists in this EventService
.
getPostCommitEventListeners
in interface EventService
public EventListenerList getEventListenerList()
public EventListenerDescriptor getEventListener(String name)
EventService
getEventListener
in interface EventService
name
- the event listener namenull
if not foundpublic EventListenerList getListenerList()
getListenerList
in interface EventServiceAdmin
public void setListenerEnabledFlag(String listenerName, boolean enabled)
setListenerEnabledFlag
in interface EventServiceAdmin
public int getActiveThreadsCount()
getActiveThreadsCount
in interface EventServiceAdmin
public int getEventsInQueueCount()
getEventsInQueueCount
in interface EventServiceAdmin
public boolean isBlockAsyncHandlers()
isBlockAsyncHandlers
in interface EventServiceAdmin
public boolean isBlockSyncPostCommitHandlers()
isBlockSyncPostCommitHandlers
in interface EventServiceAdmin
public void setBlockAsyncHandlers(boolean blockAsyncHandlers)
setBlockAsyncHandlers
in interface EventServiceAdmin
public void setBlockSyncPostCommitHandlers(boolean blockSyncPostComitHandlers)
setBlockSyncPostCommitHandlers
in interface EventServiceAdmin
public boolean isBulkModeEnabled()
isBulkModeEnabled
in interface EventServiceAdmin
public void setBulkModeEnabled(boolean bulkModeEnabled)
setBulkModeEnabled
in interface EventServiceAdmin
public void beforeCompletion()
beforeCompletion
in interface Synchronization
public void afterCompletion(int status)
afterCompletion
in interface Synchronization
Copyright © 2015 Nuxeo SA. All rights reserved.