S
- the type of the resultpublic class DirectPoller<S> extends java.lang.Object implements Poller<S>
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).Constructor and Description |
---|
DirectPoller(long interval) |
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.
|
public java.util.concurrent.Future<S> poll(java.util.concurrent.Callable<S> callable) throws java.lang.Exception
Future.get()
or
Future.get(long, TimeUnit)
will the polling actually start.poll
in interface Poller<S>
callable
- a Callable
to use to retrieve a resultjava.lang.Exception
- allows for checked exceptionsPoller.poll(Callable)