Module com.esri.arcgisruntime
Interface ListenableFuture<V>
- Type Parameters:
V
- the type of the result of the computation
- All Superinterfaces:
Future<V>
A specialized Future that allows listeners to be set to run when the
asynchronous computation is done.
- Since:
- 100.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDoneListener
(Runnable listener) Adds a listener to run on successful or unsuccessful completion of the asynchronous computation.boolean
removeDoneListener
(Runnable listener) Removes a done listener so that it will not be called when the computation completes.Returns aCompletableFuture
wrapping for this object.Methods inherited from interface java.util.concurrent.Future
cancel, exceptionNow, get, get, isCancelled, isDone, resultNow, state
-
Method Details
-
addDoneListener
Adds a listener to run on successful or unsuccessful completion of the asynchronous computation. The listener will run immediately if the computation is already complete when this method is called.Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
- Parameters:
listener
- a Runnable to run when the computation is done- Throws:
IllegalArgumentException
- if listener is null- Since:
- 100.0.0
-
removeDoneListener
Removes a done listener so that it will not be called when the computation completes.- Parameters:
listener
- the listener to be removed- Returns:
- true if the listener was removed, otherwise false
- Since:
- 100.0.0
-
toCompletableFuture
CompletableFuture<V> toCompletableFuture()Returns aCompletableFuture
wrapping for this object.- Returns:
- the completable future
- Since:
- 200.2.0
-