Class ListenableTask<V>
- java.lang.Object
-
- de.dytanic.cloudnet.common.concurrent.ListenableTask<V>
-
-
Constructor Summary
Constructors Constructor Description ListenableTask(java.util.concurrent.Callable<V> callable)ListenableTask(java.util.concurrent.Callable<V> callable, ITaskListener<V> listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull ITask<V>addListener(ITaskListener<V> listener)Vcall()booleancancel(boolean mayInterruptIfRunning)@NotNull ITask<V>clearListeners()Vget()Vget(long timeout, @NotNull java.util.concurrent.TimeUnit unit)Vget(long time, java.util.concurrent.TimeUnit timeUnit, V def)java.util.concurrent.Callable<V>getCallable()VgetDef(V def)java.util.Collection<ITaskListener<V>>getListeners()VgetValue()booleanisCancelled()booleanisDone()<T> ListenableTask<T>mapThrowable(ThrowableFunction<V,T,java.lang.Throwable> function)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.dytanic.cloudnet.common.concurrent.ITask
addListener, fireExceptionOnFailure, map, onCancelled, onComplete, onComplete, onFailure, onFailure
-
-
-
-
Constructor Detail
-
ListenableTask
public ListenableTask(java.util.concurrent.Callable<V> callable)
-
ListenableTask
public ListenableTask(java.util.concurrent.Callable<V> callable, ITaskListener<V> listener)
-
-
Method Detail
-
getCallable
public java.util.concurrent.Callable<V> getCallable()
- Specified by:
getCallablein interfaceITask<V>
-
getListeners
public java.util.Collection<ITaskListener<V>> getListeners()
- Specified by:
getListenersin interfaceITask<V>
-
getValue
public V getValue()
-
isDone
public boolean isDone()
- Specified by:
isDonein interfacejava.util.concurrent.Future<V>
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelledin interfacejava.util.concurrent.Future<V>
-
addListener
@NotNull public @NotNull ITask<V> addListener(ITaskListener<V> listener)
- Specified by:
addListenerin interfaceITask<V>
-
clearListeners
@NotNull public @NotNull ITask<V> clearListeners()
- Specified by:
clearListenersin interfaceITask<V>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancelin interfacejava.util.concurrent.Future<V>
-
get
public V get() throws java.lang.InterruptedException
- Specified by:
getin interfacejava.util.concurrent.Future<V>- Throws:
java.lang.InterruptedException
-
get
public V get(long timeout, @NotNull @NotNull java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
- Specified by:
getin interfacejava.util.concurrent.Future<V>- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
mapThrowable
public <T> ListenableTask<T> mapThrowable(ThrowableFunction<V,T,java.lang.Throwable> function)
- Specified by:
mapThrowablein interfaceITask<V>
-
-