Class ListenableTask<V>

  • All Implemented Interfaces:
    ITask<V>, java.util.concurrent.Callable<V>, java.util.concurrent.Future<V>

    @NotNull
    public class ListenableTask<V>
    extends java.lang.Object
    implements ITask<V>
    • 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:
        getCallable in interface ITask<V>
      • getValue

        public V getValue()
      • isDone

        public boolean isDone()
        Specified by:
        isDone in interface java.util.concurrent.Future<V>
      • isCancelled

        public boolean isCancelled()
        Specified by:
        isCancelled in interface java.util.concurrent.Future<V>
      • getDef

        public V getDef​(V def)
        Specified by:
        getDef in interface ITask<V>
      • get

        public V get​(long time,
                     java.util.concurrent.TimeUnit timeUnit,
                     V def)
        Specified by:
        get in interface ITask<V>
      • cancel

        public boolean cancel​(boolean mayInterruptIfRunning)
        Specified by:
        cancel in interface java.util.concurrent.Future<V>
      • get

        public V get()
              throws java.lang.InterruptedException
        Specified by:
        get in interface java.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:
        get in interface java.util.concurrent.Future<V>
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.TimeoutException
      • call

        public V call()
        Specified by:
        call in interface java.util.concurrent.Callable<V>