Class WritableFuture<V>
java.lang.Object
io.vertigo.datafactory.impl.search.WritableFuture<V>
- Type Parameters:
V- Result type
- All Implemented Interfaces:
Future<V>
WritableFuture for set result after execution.
- Author:
- npiedeloup
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning) voidMark this execution as failed.get()longbooleanbooleanisDone()onComplete(Consumer<? super WritableFuture<V>> consumer) Adds a callback that runs when the future completes, whether it succeeds, fails, or is cancelled.voidsetProgress(long progress) voidMark this execution as success.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Constructor Details
-
WritableFuture
public WritableFuture()
-
-
Method Details
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<V>
-
isDone
public boolean isDone() -
getProgress
public long getProgress() -
setProgress
public void setProgress(long progress) -
onComplete
Adds a callback that runs when the future completes, whether it succeeds, fails, or is cancelled. Any exception thrown by the callback is logged and ignored; use try/catch yourself if you need custom handling or use a dedicated thread to wait for this future completion and add your custom logic in this thread. -
get
- Specified by:
getin interfaceFuture<V>- Throws:
InterruptedExceptionExecutionException
-
get
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture<V>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
success
Mark this execution as success.- Parameters:
result- Result of execution
-
fail
Mark this execution as failed.- Parameters:
exception- Failure reason
-