public static void execute(ExecutablePool pool,String region,Function function,ServerRegionFunctionExecutor serverRegionExecutor,ResultCollector resultCollector,byte hasResult,int mRetryAttempts){
  AbstractOp op=new ExecuteRegionFunctionOpImpl(region,function,serverRegionExecutor,resultCollector,hasResult,new HashSet<String>());
  int retryAttempts=0;
  boolean reexecute=false;
  boolean reexecuteForServ=false;
  Set<String> failedNodes=new HashSet<String>();
  AbstractOp reexecOp=null;
  int maxRetryAttempts=0;
  if (function.isHA()) {
    maxRetryAttempts=mRetryAttempts;
  }
  final boolean isDebugEnabled=logger.isDebugEnabled();
  do {
    try {
      if (reexecuteForServ) {
        reexecOp=new ExecuteRegionFunctionOpImpl((ExecuteRegionFunctionOpImpl)op,(byte)1,failedNodes);
        pool.execute(reexecOp,0);
      }
 else {
        pool.execute(op,0);
      }
      reexecute=false;
      reexecuteForServ=false;
    }
 catch (    InternalFunctionInvocationTargetException e) {
      if (isDebugEnabled) {
        logger.debug("ExecuteRegionFunctionOp#execute : Received InternalFunctionInvocationTargetException. The failed nodes are {}",e.getFailedNodeSet());
      }
      reexecute=true;
      resultCollector.clearResults();
      Set<String> failedNodesIds=e.getFailedNodeSet();
      failedNodes.clear();
      if (failedNodesIds != null) {
        failedNodes.addAll(failedNodesIds);
      }
    }
catch (    ServerConnectivityException se) {
      retryAttempts++;
      if (isDebugEnabled) {
        logger.debug("ExecuteRegionFunctionOp#execute : Received ServerConnectivityException. The exception is {} The retryattempt is : {} maxRetryAttempts {}",se,retryAttempts,maxRetryAttempts);
      }
      if (se instanceof ServerOperationException) {
        throw se;
      }
      if ((retryAttempts > maxRetryAttempts && maxRetryAttempts != -1))       throw se;
      reexecuteForServ=true;
      resultCollector.clearResults();
      failedNodes.clear();
    }
  }
 while (reexecuteForServ);
  if (reexecute && function.isHA()) {
    ExecuteRegionFunctionOp.reexecute(pool,region,function,serverRegionExecutor,resultCollector,hasResult,failedNodes,maxRetryAttempts - 1);
  }
}

public static void execute ( ExecutablePool pool , String region , Function function , ServerRegionFunctionExecutor serverRegionExecutor , ResultCollector resultCollector , byte hasResult , int mRetryAttempts ) { AbstractOp op = new ExecuteRegionFunctionOpImpl ( region , function , serverRegionExecutor , resultCollector , hasResult , new HashSet < String > ( ) ) ; int retryAttempts = 0 ; boolean reexecute = false ; boolean reexecuteForServ = false ; Set < String > failedNodes = new HashSet < String > ( ) ; AbstractOp reexecOp = null ; int maxRetryAttempts = 0 ; if ( function . isHA ( ) ) { maxRetryAttempts = mRetryAttempts ; } final boolean isDebugEnabled = logger . isDebugEnabled ( ) ; do { try { if ( reexecuteForServ ) { reexecOp = new ExecuteRegionFunctionOpImpl ( ( ExecuteRegionFunctionOpImpl ) op , ( byte ) 1 , failedNodes ) ; pool . execute ( reexecOp , 0 ) ; } else { pool . execute ( op , 0 ) ; } reexecute = false ; reexecuteForServ = false ; } catch ( InternalFunctionInvocationTargetException e ) { if ( isDebugEnabled ) { logger . debug ( "ExecuteRegionFunctionOp#execute : Received InternalFunctionInvocationTargetException. The failed nodes are {}" , e . getFailedNodeSet ( ) ) ; } reexecute = true ; resultCollector . clearResults ( ) ; Set < String > failedNodesIds = e . getFailedNodeSet ( ) ; failedNodes . clear ( ) ; if ( failedNodesIds != null ) { failedNodes . addAll ( failedNodesIds ) ; } } catch ( ServerConnectivityException se ) { retryAttempts ++ ; if ( isDebugEnabled ) { logger . debug ( "ExecuteRegionFunctionOp#execute : Received ServerConnectivityException. The exception is {} The retryattempt is : {} maxRetryAttempts {}" , se , retryAttempts , maxRetryAttempts ) ; } if ( se instanceof ServerOperationException ) { throw se ; } if ( ( retryAttempts > maxRetryAttempts && maxRetryAttempts != - 1 ) ) throw se ; reexecuteForServ = true ; resultCollector . clearResults ( ) ; failedNodes . clear ( ) ; } } while ( reexecuteForServ ) ; if ( reexecute && function . isHA ( ) ) { ExecuteRegionFunctionOp . reexecute ( pool , region , function , serverRegionExecutor , resultCollector , hasResult , failedNodes , maxRetryAttempts - 1 ) ; } }
does a execute function on a server using connections from the given pool to communicate with the server .
