public interface Future
Promise
. A future is a read-only view over a
promise.
Future
objects are made composable in Golo through a set of augmentations: filter
, map
, etc.
You should consult the "golodoc" of the gololang.Async
module.Modifier and Type | Interface and Description |
---|---|
static interface |
Future.Observer
Simple interface for a future observer / callback.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
blockingGet()
Blocking get, waiting until the future has been resolved.
|
java.lang.Object |
get()
Non-blocking get.
|
boolean |
isFailed()
Test whether the future has failed.
|
boolean |
isResolved()
Test whether the future has been resolved, that is, the future is either set or failed.
|
Future |
onFail(Future.Observer observer)
Registers a callback for when the future fails.
|
Future |
onSet(Future.Observer observer)
Registers a callback for when the future is set.
|
java.lang.Object get()
null
if it has not been resolved yet.java.lang.Object blockingGet() throws java.lang.InterruptedException
java.lang.InterruptedException
- when the current thread is being interrupted.boolean isResolved()
true
if the future is resolved, false
otherwise.boolean isFailed()
true
if the future is resolved and failed, false
otherwise.Future onSet(Future.Observer observer)
observer
- the callback.Future onFail(Future.Observer observer)
observer
- the callback.