mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
18 lines
485 B
Java
18 lines
485 B
Java
|
public static void main(String[] args) throws
|
||
|
InterruptedException, ExecutionException {
|
||
|
ExecutorService pool =
|
||
|
Executors.newFixedThreadPool(4);
|
||
|
List<Future<String>> futures =
|
||
|
new ArrayList<Future<String>>();
|
||
|
|
||
|
for(int i = 0; i < 10; i++) {
|
||
|
futures.add(pool.submit(new StringTask(i)));
|
||
|
}
|
||
|
|
||
|
for(Future<String> future : futures){
|
||
|
String result = future.get();
|
||
|
System.out.println(result);
|
||
|
}
|
||
|
|
||
|
pool.shutdown();
|
||
|
}
|