core/src/main/java/org/infinispan/interceptors/distribution/TriangleDistributionInterceptor.java
// TODO: this should just override handleNonTxWriteCommand when functional commands will be triangelized
this should just override handleNonTxWriteCommand when functional commands will be triangelized
this should just override handleNonTxWriteCommand when functional commands will be triangelized
private Object handleDataWriteCommand(InvocationContext context, AbstractDataWriteCommand command) {
      assert !context.isInTxScope();
      if (command.hasAnyFlag(FlagBitSets.CACHE_MODE_LOCAL)) {
         return invokeNext(context, command);
      }
      LocalizedCacheTopology topology = checkTopologyId(command);
      DistributionInfo distributionInfo = topology.getDistribution(command.getKey());
      if (distributionInfo.isPrimary()) {
         assert context.lookupEntry(command.getKey()) != null;
         return context.isOriginLocal() ?
               localPrimaryOwnerWrite(context, command, distributionInfo) :
               remotePrimaryOwnerWrite(context, command, distributionInfo);
      } else if (distributionInfo.isWriteBackup()) {
         return context.isOriginLocal() ?
               localWriteInvocation(context, command, distributionInfo) :
               remoteBackupOwnerWrite(context, command);
      } else {
         assert context.isOriginLocal();
         return localWriteInvocation(context, command, distributionInfo);
      }
   }
private Object handleDataWriteCommand ( InvocationContext context , AbstractDataWriteCommand command ) { assert ! context . isInTxScope ( ) ; if ( command . hasAnyFlag ( FlagBitSets . CACHE_MODE_LOCAL ) ) { return invokeNext ( context , command ) ; } LocalizedCacheTopology topology = checkTopologyId ( command ) ; DistributionInfo distributionInfo = topology . getDistribution ( command . getKey ( ) ) ; if ( distributionInfo . isPrimary ( ) ) { assert context . lookupEntry ( command . getKey ( ) ) != null ; return context . isOriginLocal ( ) ? localPrimaryOwnerWrite ( context , command , distributionInfo ) : remotePrimaryOwnerWrite ( context , command , distributionInfo ) ; } else if ( distributionInfo . isWriteBackup ( ) ) { return context . isOriginLocal ( ) ? localWriteInvocation ( context , command , distributionInfo ) : remoteBackupOwnerWrite ( context , command ) ; } else { assert context . isOriginLocal ( ) ; return localWriteInvocation ( context , command , distributionInfo ) ; } }
TODO: this should just override handleNonTxWriteCommand when functional commands will be triangelized
TODO : this should just override handleNonTxWriteCommand when functional commands will be triangelized
//don't go through the triangle //always local!