Class DefaultScheduledTask<V>
- java.lang.Object
-
- de.dytanic.cloudnet.common.concurrent.DefaultScheduledTask<V>
-
- All Implemented Interfaces:
IScheduledTask<V>,ITask<V>,java.util.concurrent.Callable<V>,java.util.concurrent.Future<V>
public final class DefaultScheduledTask<V> extends java.lang.Object implements IScheduledTask<V>
-
-
Constructor Summary
Constructors Constructor Description DefaultScheduledTask(java.util.concurrent.Callable<V> callable, long delay, long repeat, long repeats, java.util.concurrent.TimeUnit timeUnit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull ITask<V>addListener(ITaskListener<V> listener)Vcall()IScheduledTask<V>cancel()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)longgetDelay()longgetDelayedTimeStamp()longgetDelayMillis()java.util.Collection<ITaskListener<V>>getListeners()longgetRepeat()longgetRepeatMillis()longgetRepeats()longgetTaskId()VgetValue()booleanisCancelled()booleanisDone()booleanisRepeatable()booleanisWait()voidsetCancelled(boolean cancelled)IScheduledTask<V>setDelayMillis(long delayMillis)voidsetDone(boolean done)IScheduledTask<V>setRepeatMillis(long repeatMillis)voidsetWait(boolean wait)-
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, onCancelled, onComplete, onComplete, onFailure, onFailure
-
-
-
-
Constructor Detail
-
DefaultScheduledTask
public DefaultScheduledTask(java.util.concurrent.Callable<V> callable, long delay, long repeat, long repeats, java.util.concurrent.TimeUnit timeUnit)
-
-
Method Detail
-
addListener
@NotNull public final @NotNull ITask<V> addListener(ITaskListener<V> listener)
- Specified by:
addListenerin interfaceITask<V>
-
getTaskId
public long getTaskId()
- Specified by:
getTaskIdin interfaceIScheduledTask<V>
-
getListeners
public java.util.Collection<ITaskListener<V>> getListeners()
- Specified by:
getListenersin interfaceITask<V>
-
getValue
public V getValue()
-
isWait
public boolean isWait()
-
setWait
public void setWait(boolean wait)
-
isDone
public boolean isDone()
- Specified by:
isDonein interfacejava.util.concurrent.Future<V>
-
setDone
public void setDone(boolean done)
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelledin interfacejava.util.concurrent.Future<V>
-
setCancelled
public void setCancelled(boolean cancelled)
-
getDelay
public long getDelay()
-
getRepeat
public long getRepeat()
-
getRepeats
public long getRepeats()
-
getDelayedTimeStamp
public long getDelayedTimeStamp()
- Specified by:
getDelayedTimeStampin interfaceIScheduledTask<V>
-
getCallable
public java.util.concurrent.Callable<V> getCallable()
- Specified by:
getCallablein 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
- Specified by:
getin interfacejava.util.concurrent.Future<V>- Throws:
java.lang.InterruptedException
-
isRepeatable
public boolean isRepeatable()
- Specified by:
isRepeatablein interfaceIScheduledTask<V>
-
setDelayMillis
public IScheduledTask<V> setDelayMillis(long delayMillis)
- Specified by:
setDelayMillisin interfaceIScheduledTask<V>
-
getDelayMillis
public long getDelayMillis()
- Specified by:
getDelayMillisin interfaceIScheduledTask<V>
-
setRepeatMillis
public IScheduledTask<V> setRepeatMillis(long repeatMillis)
- Specified by:
setRepeatMillisin interfaceIScheduledTask<V>
-
getRepeatMillis
public long getRepeatMillis()
- Specified by:
getRepeatMillisin interfaceIScheduledTask<V>
-
cancel
public IScheduledTask<V> cancel()
- Specified by:
cancelin interfaceIScheduledTask<V>
-
-