|
GigaSpaces XAP 7.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openspaces.events.adapter.AbstractResultEventListenerAdapter
public abstract class AbstractResultEventListenerAdapter
A base class event listener allowing for event listeners result handling by writing it back to
the space. Subclasses should implement
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 Summary | |
---|---|
AbstractResultEventListenerAdapter()
|
Method Summary | |
---|---|
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). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractResultEventListenerAdapter()
Method Detail |
---|
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 perofrm 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 space
DataAccessException
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)
|
GigaSpaces XAP 7.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |