17 |
|
* <b>Sample Usage</b> (Note that the following classes are all |
18 |
|
* made-up.) <p> |
19 |
|
* <pre> |
20 |
< |
* class ArchiveSearcher { String search(String target); } |
20 |
> |
* interface ArchiveSearcher { String search(String target); } |
21 |
|
* class App { |
22 |
|
* Executor executor = ... |
23 |
|
* ArchiveSearcher searcher = ... |
36 |
|
* } |
37 |
|
* </pre> |
38 |
|
* |
39 |
+ |
* The {@link Executors} class contains more convenient methods |
40 |
+ |
* for common usages. For example, the above explicit |
41 |
+ |
* construction could be replaced with: |
42 |
+ |
* <pre> |
43 |
+ |
* Future<String> future = Executors.execute(executor, |
44 |
+ |
* new Callable<String>() { |
45 |
+ |
* public String call() { |
46 |
+ |
* return searcher.search(target); |
47 |
+ |
* }}); |
48 |
+ |
* </pre> |
49 |
|
* @since 1.5 |
50 |
|
* @see FutureTask |
51 |
|
* @see Executor |