@Override
    public void run() {
      if (recordUploadFailed) {
        Logger.info(
            LOG_TAG, "Previous record upload failed.  Failing all records and not retrying.");
        Exception ex = new Server11PreviousPostFailedException();
        for (String guid : outgoingGuids) {
          delegate.onRecordStoreFailed(ex, guid);
        }
        return;
      }

      if (outgoing == null || outgoing.size() == 0) {
        Logger.debug(LOG_TAG, "No items: RecordUploadRunnable returning immediately.");
        return;
      }

      URI u = serverRepository.collectionURI();
      SyncStorageRequest request = new SyncStorageRequest(u);

      request.delegate = this;

      // We don't want the task queue to proceed until this request completes.
      // Fortunately, BaseResource is currently synchronous.
      // If that ever changes, you'll need to block here.
      ByteArraysEntity body = getBodyEntity();
      request.post(body);
    }
 private void consumerIsDone() {
   long counterNow = this.counter;
   Logger.info(
       LOG_TAG,
       "Consumer is done. Processed "
           + counterNow
           + ((counterNow == 1) ? " record." : " records."));
   delegate.consumerIsDone(stopImmediately);
 }