public class

DataSources

extends Object
java.lang.Object
   ↳ com.facebook.datasource.DataSources

Class Overview

Static utility methods pertaining to the DataSource interface.

Summary

Public Methods
static <T> Supplier<DataSource<T>> getFailedDataSourceSupplier(Throwable failure)
static <T> DataSource<T> immediateDataSource(T result)
static <T> DataSource<T> immediateFailedDataSource(Throwable failure)
static <T> T waitForFinalResult(DataSource<T> dataSource)
This methods blocks the calling thread until the DataSource has a final result, has been cancelled or has failed.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static Supplier<DataSource<T>> getFailedDataSourceSupplier (Throwable failure)

public static DataSource<T> immediateDataSource (T result)

public static DataSource<T> immediateFailedDataSource (Throwable failure)

public static T waitForFinalResult (DataSource<T> dataSource)

This methods blocks the calling thread until the DataSource has a final result, has been cancelled or has failed.

Parameters
dataSource The DataSource to wait for. The caller MUST close the data source after this method returned!
Returns
  • The final result of the DataSource. Intermediate results are ignored. Might be null if the data source has been cancelled.
Throws
Throwable if the DataSource has failed