Scrollbar |
---|
The ParallelExecutor service allows a computation to occur in parallel.
It can be used in two ways. First, with an explicit Future:
Code Block | ||||
---|---|---|---|---|
| ||||
Future<String> future = executor.invoke(new Invokable<String>() { ... }); |
The executor will submit the Invokable to a thread pool for execution in the background.
...
Another alternative will return an object proxy, not a Future:
Code Block | ||||
---|---|---|---|---|
| ||||
RSSFeed feed = executor.invoke(RSSFeed.class, new Invokable<RSSFeed>() { ... }); |
This only works if the type is an interface. A proxy for the interface is created around the Future object; any invocation on the proxy will invoke get() on the Future (that is, will block until the value is computed).
...
Since | ||
---|---|---|
| ||
Defaults to 100.
Scrollbar |
---|