34 |
|
* throws InterruptedException { |
35 |
|
* Future<String> future |
36 |
|
* = executor.submit(new Callable<String>() { |
37 |
< |
* public String call() { return searcher.search(target); } |
38 |
< |
* }); |
37 |
> |
* public String call() { |
38 |
> |
* return searcher.search(target); |
39 |
> |
* }}); |
40 |
|
* displayOtherThings(); // do other things while searching |
41 |
|
* try { |
42 |
|
* displayText(future.get()); // use future |
74 |
|
* whether the thread executing this task should be interrupted in |
75 |
|
* an attempt to stop the task. |
76 |
|
* |
77 |
+ |
* <p>After this method returns, subsequent calls to {@link #isDone} will |
78 |
+ |
* always return <tt>true</tt>. Subsequent calls to {@link #isCancelled} |
79 |
+ |
* will always return <tt>true</tt> if this method returned <tt>true</tt>. |
80 |
+ |
* |
81 |
|
* @param mayInterruptIfRunning <tt>true</tt> if the thread executing this |
82 |
|
* task should be interrupted; otherwise, in-progress tasks are allowed |
83 |
|
* to complete |