SiroKuro #7966(2008/11/06 18:05 GMT) [ Java ] Rating1/1=1.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
import java.util.concurrent.*; public class test { public static void main(String[] args) { ExecutorService executor = Executors.newCachedThreadPool(); final CyclicBarrier barrier = new CyclicBarrier(2); try { // その1 executor.submit(new Callable<Object>(){ public Object call() throws Exception { for(int i = 1; i <= 10; i++) { barrier.await(); System.out.println(i); } return null; } }); // その2 executor.submit(new Callable<Object>(){ public Object call() throws Exception { for(char c = 'A'; c <= 'J'; c++) { barrier.await(); System.out.println(c); } return null; } }); } finally { executor.shutdown(); } } }
Rating1/1=1.00-0+
[ reply ]
SiroKuro
#7966()
[
Java
]
Rating1/1=1.00
Rating1/1=1.00-0+
[ reply ]