public interface BeanPersistListener
These listen events occur after a successful commit. They also occur in a background thread rather than the thread used to perform the actual insert update or delete. In this way there is a delay between the commit and when the listener is notified of the event.
For a cluster these events may need to be broadcast. Each of the inserted(), updated() and deleted() methods return true if you want those events to be broadcast to the other members of a cluster (the id values are broadcast). If these methods return false then the events are not broadcast.
It is worth noting that BeanPersistListener is different in three main ways from BeanPersistController postXXX methods.
A BeanPersistListener is either found automatically via class path search or
can be added programmatically via ServerConfig.add(BeanPersistListener)}.
ServerConfig.add(BeanPersistListener)| Modifier and Type | Method and Description |
|---|---|
boolean |
deleted(Object bean)
Notified that a bean has been deleted locally.
|
boolean |
inserted(Object bean)
Notified that a bean has been inserted locally.
|
boolean |
isRegisterFor(Class<?> cls)
Return true if this BeanPersistListener should be registered for events
on this entity type.
|
void |
remoteDelete(Object id)
Notify that a bean was deleted on another node of the cluster.
|
void |
remoteInsert(Object id)
Notify that a bean was inserted on another node of the cluster.
|
void |
remoteUpdate(Object id)
Notify that a bean was updated on another node of the cluster.
|
boolean |
updated(Object bean,
Set<String> updatedProperties)
Notified that a bean has been updated locally.
|
boolean isRegisterFor(Class<?> cls)
boolean inserted(Object bean)
bean - The bean that was inserted.boolean updated(Object bean, Set<String> updatedProperties)
bean - The bean that was updated.updatedProperties - The properties that were modified by this update.boolean deleted(Object bean)
bean - The bean that was deleted.void remoteInsert(Object id)
id - the id value of the inserted beanvoid remoteUpdate(Object id)
id - the id value of the updated bean.void remoteDelete(Object id)
id - the id value of the deleted bean.Copyright © 2016. All rights reserved.