public interface ChangeRecord<K,V>
ChangeRecords are typically provided to EventInterceptors
as part of a FederatedChangeEvent for the purpose of inspecting and
possibly modifying an entry prior to it being committed.
EventInterceptors may choose to
reject the change or
change the value. When no change is specified
the modified value is committed.
Any updates to a ChangeRecord will overwrite the modified Entry and
thus the updated value when the change is committed.
When ChangeRecord is for a local participant, the original and
local entry will be the same.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ChangeRecord.Entry<K,V>
Represents the key, value and name of the
Participant from
which the entry originated. |
| Modifier and Type | Method and Description |
|---|---|
ChangeRecord<Binary,Binary> |
getBinaryChangeRecord()
|
FederatedChangeEvent.Type |
getEventType()
The type of the FederatedChangeEvent.
|
K |
getKey()
Obtain the key of the changed
ChangeRecord.Entry. |
ChangeRecord.Entry<K,V> |
getLocalEntry()
Obtains a representation of
ChangeRecord.Entry as it appears in the local
participant. |
ChangeRecord.Entry<K,V> |
getModifiedEntry()
Obtain a representation of the modified
ChangeRecord.Entry. |
ChangeRecord.Entry<K,V> |
getOriginalEntry()
Obtain a representation of the
ChangeRecord.Entry prior to any changes
occurring. |
boolean |
isDeleted()
Determine if the modified entry in the ChangeRecord was deleted.
|
boolean |
isLocalOnly()
Determine whether the change represented by this ChangeRecord is
local only, therefore not federated.
|
boolean |
isSynthetic()
Determine if this Entry has been synthetically mutated.
|
void |
rejectChange()
Signal that the modified
ChangeRecord.Entry should not be applied. |
void |
setLocalOnly(boolean bLocal)
Set the local only flag to indicate that the change is not
federated.
|
void |
setValue(V newValue)
Update the modified
ChangeRecord.Entry value. |
void |
setValue(V newValue,
boolean fSynthetic)
Update the modified
ChangeRecord.Entry value with a synthetic flag. |
<T> void |
update(ValueUpdater<V,T> updater,
T oValue)
Update the modified Entry's value using the given
ValueUpdater. |
K getKey()
ChangeRecord.Entry.ChangeRecord.Entry<K,V> getModifiedEntry()
ChangeRecord.Entry.
This ChangeRecord.Entry will be used to modify the associated ChangeRecord.Entry
in the destination participant.
ChangeRecord.Entry<K,V> getOriginalEntry()
ChangeRecord.Entry prior to any changes
occurring.
This is typically a representation of the ChangeRecord.Entry at the
source participant prior to a change occurring.
ChangeRecord.Entry<K,V> getLocalEntry()
ChangeRecord.Entry as it appears in the local
participant.FederatedChangeEvent.Type getEventType()
void setValue(V newValue)
ChangeRecord.Entry value.
This method can potentially cause the change to be propagated back to the origin participant. Care must be taken to avoid any recursive ping-pong cycles.
newValue - new value for the modified entryvoid setValue(V newValue, boolean fSynthetic)
ChangeRecord.Entry value with a synthetic flag.
This method can potentially cause the change to be propagated back to the origin participant. Care must be taken to avoid any recursive ping-pong cycles.
Note: Marking a change as synthetic will have different behavior depending on the federation event type: COMMITTING_LOCAL - the change will not be federated to other clusters and CacheStores will not be called. REPLICATING - setting the change synthetic is not allowed. An UnsupportedOperationException will be thrown. COMMITTING_REMOTE - the change will be applied as a synthetic change. CacheStores will not be triggered and federation will not forward the change to other clusters from this destination cluster.
newValue - new value for the modified entryfSynthetic - a flag to indicate whether the update is synthetic<T> void update(ValueUpdater<V,T> updater, T oValue)
ValueUpdater.updater - a ValueUpdater used to modify the Entry's valueoValue - the new value for this Entryvoid rejectChange()
ChangeRecord.Entry should not be applied.
The local ChangeRecord.Entry should remain unchanged.boolean isDeleted()
ChangeRecord<Binary,Binary> getBinaryChangeRecord()
void setLocalOnly(boolean bLocal)
Note: this setting is only applicable to FederatedChangeEvent.Type#COMMITTING_LOCAL
events.
bLocal - a flag to indicate whether to keep the change local onlyboolean isLocalOnly()
Note: this setting is only applicable to FederatedChangeEvent.Type#COMMITTING_LOCAL
events.
boolean isSynthetic()
false if either a non-synthetic update was made or
the entry has not been modified.