org.springframework.batch.poller

## Class DirectPoller<S>

- java.lang.Object
- - org.springframework.batch.poller.DirectPoller<S>

- Type Parameters:
    `S` - the type of the result
  All Implemented Interfaces:
    Poller<S>

      public class DirectPoller<S>
      extends java.lang.Object
      implements Poller<S>

  A `Poller` that uses the callers thread to poll for a result as soon as it is asked for. This is often appropriate if you expect a result relatively quickly, or if there is only one such result expected (otherwise it is more efficient to use a background thread to do the polling).
  Author:
    Dave Syer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DirectPoller(long interval)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.concurrent.Future<S>` | `poll(java.util.concurrent.Callable<S> callable)` Get a future for a non-null result from the callback.

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

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

- - ### Constructor Detail

    - #### DirectPoller

          public DirectPoller(long interval)

  - ### Method Detail

    - #### poll

          public java.util.concurrent.Future<S> poll(java.util.concurrent.Callable<S> callable)
                                              throws java.lang.Exception

      Get a future for a non-null result from the callback. Only when the result is asked for (using `Future.get()` or `Future.get(long, TimeUnit)` will the polling actually start.
      Specified by:
        `poll` in interface `Poller<S>`
      Parameters:
        `callable` - a `Callable` to use to retrieve a result
      Returns:
        a future which itself can be used to get the result
      Throws:
        `java.lang.Exception` - allows for checked exceptions
      See Also:
        `Poller.poll(Callable)`