private boolean netWrite(CacheEvent event, int action, Set writeCandidateSet)
      throws CacheWriterException, TimeoutException {
    if (writeCandidateSet == null || writeCandidateSet.isEmpty()) {
      return false;
    }
    ArrayList list = new ArrayList(writeCandidateSet);
    Collections.shuffle(list);
    InternalDistributedMember[] writeCandidates =
        (InternalDistributedMember[]) list.toArray(new InternalDistributedMember[0]);
    initRemainingTimeout();
    int index = 0;
    do {
      InternalDistributedMember next = writeCandidates[index++];
      Set set = new HashSet();
      set.add(next);
      netWriteSucceeded = false;
      requestInProgress = true;
      remoteException = null;
      NetWriteRequestMessage.sendMessage(this, regionName, remainingTimeout, event, set,
          action);
      if (remainingTimeout <= 0) { // @todo: should this throw a timeout exception?
        break;
      }
      waitForObject2(remainingTimeout);
      if (netWriteSucceeded) {
        netWrite = true;
        break;
      }
      if (remoteException != null) {
        Throwable cause;
        if (remoteException instanceof TryAgainException) {
          if (index < writeCandidates.length) {
            continue;
          } else {
            break;
          }
        }
        if (remoteException instanceof CacheWriterException
            && remoteException.getCause() != null) {
          cause = remoteException.getCause();
        } else {
          cause = remoteException;
        }
        throw new CacheWriterException(
            String.format("While invoking a remote netWrite: %s",
                cause),
            cause);
      }
    } while (index < writeCandidates.length);

    return netWriteSucceeded;
  }
Return true if cache writer was invoked
geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java