public Optional<CliFunctionResult> reconnect(String memberName, int retries,
        int copiedEntries, Exception e) {
      close();
      if (retries >= MAX_BATCH_SEND_RETRIES) {
        return Optional.of(new CliFunctionResult(memberName,
            CliFunctionResult.StatusState.ERROR,
            CliStrings.format(
                WAN_COPY_REGION__MSG__ERROR__AFTER__HAVING__COPIED,
                "Connection error", copiedEntries)));
      }
      logger.error("Exception {} in sendBatch. Retrying", e.getClass().getName());
      try {
        connection = senderPool.acquireConnection();
      } catch (NoAvailableServersException | AllConnectionsInUseException e1) {
        return Optional.of(new CliFunctionResult(memberName,
            CliFunctionResult.StatusState.ERROR,
            CliStrings.format(
                WAN_COPY_REGION__MSG__NO__CONNECTION,
                copiedEntries)));
      }
      return Optional.empty();
    }
It runs the actions to be done after a batch has been
sent: throw an interrupted exception if the operation was canceled and
adjust the rate of copying by sleeping if necessary.

@param startTime time at which the entries started to be copied
@param copiedEntries number of entries copied so far
@param maxRate maximum copying rate
geode-wan/src/main/java/org/apache/geode/management/internal/cli/functions/WanCopyRegionFunctionDelegate.java