VMware GemFire Java API Reference
Interface GatewayConflictResolver
It can apply input by calling either of the methods on GatewayConflictResolver.
To disallow the new event it should call GatewayConflictHelper.disallowEvent().
To modify the incoming value of the new event, it should call
GatewayConflictHelper.changeEventValue(java.lang.Object).
It can use the TimestampedEntryEvent when deciding if the event should be disallowed.
If a resolver is not installed then the default conflict resolution logic is:
if (event.getNewTimestamp() > event.getOldTimestamp()) {
return; // allow
}
if (event.getNewTimestamp() == event.getOldTimestamp() && event.getNewDistributedSystemID() >=
event.getOldDistributedSystemID()) {
return; //allow
}
helper.disallowEvent();
You should only add a GatewayConflictResolver if your implementation has different resolution
logic or if you need to call GatewayConflictHelper.changeEventValue(java.lang.Object) since invoking the
resolver has some performance impact.- Since:
- GemFire 7.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidonEvent(TimestampedEntryEvent event, GatewayConflictHelper helper) Invoked when a WAN gateway change is applied and the product routes the event through conflict handling.
-
Method Details
-
onEvent
Invoked when a WAN gateway change is applied and the product routes the event through conflict handling.The given
GatewayConflictHelpercan be used to disallow the modification, or change the value to be stored in the cache.This method is invoked under synchronization on the cache entry in order to prevent concurrent modification.
For any two events, all
GatewayConflictResolversmust make the same decision on the resolution of the conflict in order to maintain consistency. They must do so regardless of the order of the events.In previous releases, this method was not called if the following was true:
So if you have a resolver and want to restore this old behavior, you should check this condition at the start of your onEvent and return if it is true.event.getNewDistributedSystemID() == event.getOldDistributedSystemID() && event.getNewTimestamp() >= event.getOldTimestamp()- Parameters:
event- the event that is in conflict with the current cache statehelper- an object to be used in modifying the course of action for this event
-