Interface GatewayConflictResolver


public interface GatewayConflictResolver
GatewayConflictResolver is a Cache-level plugin that is called upon to decide what to do with events that originate in other systems and arrive through the WAN Gateway.

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 Type
    Method
    Description
    void
    Invoked when a WAN gateway change is applied and the product routes the event through conflict handling.
  • Method Details

    • onEvent

      void onEvent(TimestampedEntryEvent event, GatewayConflictHelper helper)
      Invoked when a WAN gateway change is applied and the product routes the event through conflict handling.

      The given GatewayConflictHelper can 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 GatewayConflictResolvers must 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:

       
       event.getNewDistributedSystemID() == event.getOldDistributedSystemID() &&
       event.getNewTimestamp() >= event.getOldTimestamp()
        
       
      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.
      Parameters:
      event - the event that is in conflict with the current cache state
      helper - an object to be used in modifying the course of action for this event