almost.functional.reactive
T
- the type the supplier is committed to provide.public class Promise<T> extends java.lang.Object implements java.lang.Runnable
This implements Runnable so that it can be tucked into a Future etc. Once the Observer is completed it is released.
Modifier and Type | Class and Description |
---|---|
static class |
Promise.State
The current state of the promise.
|
Constructor and Description |
---|
Promise(Supplier<T> supplier,
Observer<T> observer)
Create a Promise based on a given supplier and with an Observer.
|
Modifier and Type | Method and Description |
---|---|
Promise.State |
getState()
Get the current state of this promise.
|
void |
run()
This method calls the supplier and on successful completion informs the fulfilled consumers of the
return value.
|
public void run()
run
in interface java.lang.Runnable
public Promise.State getState()