Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.09 KB

ref_listeners_synchronicity.adoc

File metadata and controls

30 lines (25 loc) · 1.09 KB

Synchronicity of events

By default, all async notifications are dispatched in the notification thread pool. Sync notifications will delay the operation from continuing until the listener method completes or the CompletionStage completes (the former causing the thread to block). Alternatively, you could annotate your listener as asynchronous in which case the operation will continue immediately, while the notification is completed asynchronously on the notification thread pool. To do this, simply annotate your listener such:

Asynchronous Listener
link:code_examples/ListenerMyAsync.java[role=include]
Blocking Synchronous Listener
link:code_examples/ListenerMySync.java[role=include]
Non-Blocking Listener
link:code_examples/ListenerMyNonBlocking.java[role=include]

Asynchronous thread pool

To tune the thread pool used to dispatch such asynchronous notifications, use the <listener-executor /> XML element in your configuration file.