@Override
    public boolean close() {
      DataSource<T> currentDataSource;
      DataSource<T> dataSourceWithResult;
      synchronized (FirstAvailableDataSource.this) {
        // it's fine to call {@code super.close()} within a synchronized block because we don't
        // implement {@link #closeResult()}, but perform result closing ourselves.
        if (!super.close()) {
          return false;
        }
        currentDataSource = mCurrentDataSource;
        mCurrentDataSource = null;
        dataSourceWithResult = mDataSourceWithResult;
        mDataSourceWithResult = null;
      }
      closeSafely(dataSourceWithResult);
      closeSafely(currentDataSource);
      return true;
    }
{@link DataSource} supplier that provides a data source which will forward results of the first
available data source.

<p>Data sources are obtained in order. Only if the current data source fails, or if it finishes
without result, the next one will be tried.
fbcore/src/main/java/com/facebook/datasource/FirstAvailableDataSourceSupplier.java