public class TaskExecutorEventListenerAdapter extends Object implements SpaceDataEventListener, org.springframework.beans.factory.InitializingBean, EventListenerAdapter
SpaceDataEventListener
to Spring TaskExecutor
implementation (usually to be executed in a different thread).
Very handy when using notifications in order to release the notification thread.
Defualt task executor uses SimpleAsyncTaskExecutor
which creates a new thread for each
request.
TaskExecutor
Constructor and Description |
---|
TaskExecutorEventListenerAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Initializes the task executor adapter.
|
Object |
getActualEventListener() |
void |
onEvent(Object data,
GigaSpace gigaSpace,
org.springframework.transaction.TransactionStatus txStatus,
Object source)
Listens for events and and delegates them to the
setDelegate(org.openspaces.events.SpaceDataEventListener)
to be executed using the provided setTaskExecutor(org.springframework.core.task.TaskExecutor) . |
void |
setDelegate(SpaceDataEventListener delegate)
Sets the delegate that will invoked using the task executor.
|
void |
setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Sets the task executor to be used to delegate the execution of the
delegate listener. |
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
delegate
listener.
Defualts to SimpleAsyncTaskExecutor
which creates a new thread for each request.
public void setDelegate(SpaceDataEventListener delegate)
public void afterPropertiesSet() throws Exception
taskExecutor
is provided will
create a default one using SimpleAsyncTaskExecutor
.afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public Object getActualEventListener()
getActualEventListener
in interface EventListenerAdapter
public void onEvent(Object data, GigaSpace gigaSpace, org.springframework.transaction.TransactionStatus txStatus, Object source)
setDelegate(org.openspaces.events.SpaceDataEventListener)
to be executed using the provided setTaskExecutor(org.springframework.core.task.TaskExecutor)
.onEvent
in interface SpaceDataEventListener
data
- The actual data object of the eventgigaSpace
- A GigaSpace instance that can be used to perform additional operations
against the spacetxStatus
- An optional transaction status allowing to rollback a transaction
programmaticallysource
- Optional additional data or the actual source event data object (where
relevant)Copyright © GigaSpaces.