public abstract class AbstractResultEventListenerAdapter extends Object implements SpaceDataEventListener
onEventWithResult(Object,GigaSpace,TransactionStatus,Object)
with the result being
writing to back to the space. The write lease can be controlled using
setWriteLease(long)
.Constructor and Description |
---|
AbstractResultEventListenerAdapter() |
Modifier and Type | Method and Description |
---|---|
protected void |
handleResult(Object result,
GigaSpace gigaSpace)
Writes the result back to the space (if not
null ) under the configured write
lease. |
void |
onEvent(Object data,
GigaSpace gigaSpace,
TransactionStatus txStatus,
Object source)
Implements the
SpaceDataEventListener by delegating to
onEventWithResult(Object,org.openspaces.core.GigaSpace,org.springframework.transaction.TransactionStatus,Object)
and writing the result back to the space (if it is not null ) using
handleResult(Object,org.openspaces.core.GigaSpace) . |
protected abstract Object |
onEventWithResult(Object data,
GigaSpace gigaSpace,
TransactionStatus txStatus,
Object source)
An event listener callback allowing to return a result that will be written back to the space.
|
void |
setUpdateOrWrite(boolean updateOrWrite)
Sets if the write operation will perform an update in case the entry result already exists in
the space.
|
void |
setUpdateTimeout(long updateTimeout)
Sets the update timeout (im milliseconds) in case the flag
setUpdateOrWrite(boolean) is set to
true . |
void |
setWriteLease(long writeLease)
The lease time the result will be written under (in milliseconds).
|
public void setWriteLease(long writeLease)
Lease.FOREVER
.writeLease
- The lease time the result will be written underpublic void setUpdateOrWrite(boolean updateOrWrite)
true
.public void setUpdateTimeout(long updateTimeout)
setUpdateOrWrite(boolean)
is set to
true
.public void onEvent(Object data, GigaSpace gigaSpace, TransactionStatus txStatus, Object source)
SpaceDataEventListener
by delegating to
onEventWithResult(Object,org.openspaces.core.GigaSpace,org.springframework.transaction.TransactionStatus,Object)
and writing the result back to the space (if it is not null
) using
handleResult(Object,org.openspaces.core.GigaSpace)
.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)protected void handleResult(Object result, GigaSpace gigaSpace) throws DataAccessException
null
) under the configured write
lease. Allows to be overridden in order to implement more advance result handling.
By default handles both single object and array of objects. Takes into account the
'updateOrWrite'
flag when writing/updating the result back
to the space.
result
- The result to write back to the spacegigaSpace
- The GigaSpace instance to operate against the spaceDataAccessException
protected abstract Object onEventWithResult(Object data, GigaSpace gigaSpace, TransactionStatus txStatus, Object source)
data
- The event data objectgigaSpace
- 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.