Back to Fresco

StatefulRunnable

docs/javadoc/reference/com/facebook/common/executors/StatefulRunnable.html

3.6.014.4 KB
Original Source

Fresco

|

|

Packages | Classes

Interfaces

Classes

Packages | Classes

Summary: Constants | Fields | Ctors | Methods | Protected Methods | Inherited Methods | [Expand All]

public abstract class

StatefulRunnable

extends Object
implements Runnable

| java.lang.Object | | ↳ | com.facebook.common.executors.StatefulRunnable<T> |

| Known Direct Subclasses

StatefulProducerRunnable<T>

| StatefulProducerRunnable<T> | StatefulRunnable intended to be used by producers. |

|

Class Overview

Abstraction for computation.

Computation expressed as StatefulRunnable can be cancelled, but only if it has not started yet.

For better decoupling of the code computing the result and the code that handles it, 4 separate methods are provided: getResult, onSuccess, onFailure and onCancellation.

This runnable can be run only once. Subsequent calls to run method won't have any effect.

Summary

Constants
int
int
int
int
int
Fields
protected final AtomicInteger
Public Constructors
Public Methods
void
final void
Protected Methods
void
Called after onSuccess callback completes in order to dispose the result.
abstract T
void
Called when the runnable is cancelled.
void
Called if exception occurred during computation.
void
Called after computing result successfully.

| [Expand] Inherited Methods | | --- | | From class java.lang.Object

| Object | clone() | | boolean | equals(Object arg0) | | void | finalize() | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

| | From interface java.lang.Runnable

| abstract void | run() |

|

Constants

protected static final int STATE_CANCELLED

Constant Value: 2 (0x00000002)

protected static final int STATE_CREATED

Constant Value: 0 (0x00000000)

protected static final int STATE_FAILED

Constant Value: 4 (0x00000004)

protected static final int STATE_FINISHED

Constant Value: 3 (0x00000003)

protected static final int STATE_STARTED

Constant Value: 1 (0x00000001)

Fields

protected final AtomicInteger mState

Public Constructors

public StatefulRunnable()

Public Methods

public void cancel()

public final void run()

Protected Methods

protected void disposeResult(T result)

Called after onSuccess callback completes in order to dispose the result.

protected abstract T getResult()

Throws

| Exception | |

protected void onCancellation()

Called when the runnable is cancelled.

protected void onFailure(Exception e)

Called if exception occurred during computation.

protected void onSuccess(T result)

Called after computing result successfully.

+Generated by Doclava. +