com.hammurapi.common.concurrent

## Class NonBlockingNotifyingFutureTask<V>

- java.lang.Object
- - java.util.concurrent.FutureTask<V>
  - - com.hammurapi.common.concurrent.NonBlockingNotifyingFutureTask<V>

- Type Parameters:
    `V` -
  All Implemented Interfaces:
    NotifyingFuture<V>, Runnable, Future<V>, RunnableFuture<V>

      public class NonBlockingNotifyingFutureTask<V>
      extends FutureTask<V>
      implements NotifyingFuture<V>

  Future task which cannot block in get() indefinitely. If it is not yet started, the task gets executed in the caller thread.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NonBlockingNotifyingFutureTask(Callable<V> callable, TaskCounter taskCounter)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addListener(CallableListener<V> listener)` Adds callable listener.
    `V` | `get()`
    `void` | `removeListener(CallableListener<V> listener)` Removes callable listener.
    `void` | `run()`

    - ### Methods inherited from class java.util.concurrent.FutureTask

      `cancel, done, get, isCancelled, isDone, runAndReset, set, setException`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.concurrent.Future

      `cancel, get, isCancelled, isDone`

- - ### Constructor Detail

    - #### NonBlockingNotifyingFutureTask

          public NonBlockingNotifyingFutureTask(Callable<V> callable,
                                        TaskCounter taskCounter)

  - ### Method Detail

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`
      Specified by:
        `run` in interface `RunnableFuture<V>`
      Overrides:
        `run` in class `FutureTask<V>`

    - #### get

          public V get()
                throws InterruptedException,
                       ExecutionException

      Specified by:
        `get` in interface `Future<V>`
      Overrides:
        `get` in class `FutureTask<V>`
      Throws:
        `InterruptedException`
        `ExecutionException`

    - #### addListener

          public void addListener(CallableListener<V> listener)

      Description copied from interface: `NotifyingFuture`
      Adds callable listener.
      Specified by:
        `addListener` in interface `NotifyingFuture<V>`

    - #### removeListener

          public void removeListener(CallableListener<V> listener)

      Description copied from interface: `NotifyingFuture`
      Removes callable listener.
      Specified by:
        `removeListener` in interface `NotifyingFuture<V>`