Package cn.sliew.milky.concurrent
Class SucceededFuture<V>
- java.lang.Object
-
- cn.sliew.milky.concurrent.AbstractFuture<V>
-
- cn.sliew.milky.concurrent.CompleteFuture<V>
-
- cn.sliew.milky.concurrent.SucceededFuture<V>
-
public class SucceededFuture<V> extends CompleteFuture<V>
TheCompleteFuturewhich is succeeded already.
-
-
Constructor Summary
Constructors Constructor Description SucceededFuture(V result)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Throwablecause()Returns the cause of the failed operation if the operation has failed.VgetNow()Return the result without blocking.booleanisSuccess()Returnstrueif and only if the operation was completed successfully.-
Methods inherited from class cn.sliew.milky.concurrent.CompleteFuture
addListener, await, await, cancel, isCancelled, isDone, removeListener, sync
-
Methods inherited from class cn.sliew.milky.concurrent.AbstractFuture
get, get
-
-
-
-
Constructor Detail
-
SucceededFuture
public SucceededFuture(V result)
-
-
Method Detail
-
isSuccess
public boolean isSuccess()
Description copied from interface:FutureReturnstrueif and only if the operation was completed successfully.
-
cause
public Throwable cause()
Description copied from interface:FutureReturns the cause of the failed operation if the operation has failed.- Returns:
- the cause of the failure.
nullif succeeded or this future is not completed yet.
-
getNow
public V getNow()
Description copied from interface:FutureReturn the result without blocking. If the future is not done yet this will returnnull.As it is possible that a
nullvalue is used to mark the future as successful you also need to check if the future is really done withFuture.isDone()and not relay on the returnednullvalue.
-
-