private boolean setResultInternal(@Nullable T value, boolean isLast) {
    T resultToClose = null;
    try {
      synchronized (this) {
        if (mIsClosed || mDataSourceStatus != DataSourceStatus.IN_PROGRESS) {
          resultToClose = value;
          return false;
        } else {
          if (isLast) {
            mDataSourceStatus = DataSourceStatus.SUCCESS;
            mProgress = 1;
          }
          if (mResult != value) {
            resultToClose = mResult;
            mResult = value;
          }
          return true;
        }
      }
    } finally {
      if (resultToClose != null) {
        closeResult(resultToClose);
      }
    }
  }
Subclasses should invoke this method to set the progress.

<p>This method will return {@code true} if the progress was successfully set, or {@code false}
if the data source has already been set, failed or closed.

<p>This will also notify the subscribers if the progress was successfully set.

<p>Do NOT call this method from a synchronized block as it invokes external code of the
subscribers.

@param progress the progress in range [0, 1] to be set.
@return true if the progress was successfully set.
fbcore/src/main/java/com/facebook/datasource/AbstractDataSource.java