ther things while searching try { displayText(future.get()); // use future } catch (ExecutionException ex) { cleanup(); return; } } } The {@link FutureTask} class is an implementation of
Future thatimplements
Runnable, and so may be executed by an
Executor. For example, the above construction with
submit could be replaced by:
FutureTask<String> future = new FutureTask<String>(new Callable<String>() { public String call() { return searcher.search(target); }}); executor.execute(future);
@see FutureTask
@see Executor
@since 1.5
@author Doug Lea