code: @Override
    public void writeImpl(D record) throws IOException {
      if (!isRetry()) {
        //If currentRequest is still here, it means this is retry request.
        //In this case, don't invoke onNewRecord again as onNewRecord is not guaranteed to be idempotent.
        //(e.g: If you do batch processing duplicate record can go in, etc.)
        curRequest = onNewRecord(record);
      }
  
      if (curRequest.isPresent()) {
        ListenableFuture<CloseableHttpResponse> responseFuture = sendRequest(curRequest.get());
        try (CloseableHttpResponse response = waitForResponse(responseFuture)) {
          processResponse(response);
        }
        curRequest = Optional.absent(); //Clear request if successful
      }
      numRecordsWritten++;
    }
docs: Send and process the request. If it's a retry request, skip onNewRecord method call and go straight sending request.
  {@inheritDoc}