コード例 #1
0
  public void testJoin() throws Exception {
    ExecutorService es = Executors.newFixedThreadPool(10);
    List<MyRunnable> runnables = new ArrayList<MyRunnable>();
    for (int i = 0; i < 6; i++) {
      runnables.add(new MyRunnable(service.getEPRuntime()));
    }

    for (Runnable toRun : runnables) {
      es.submit(toRun);
    }
    es.shutdown();
    es.awaitTermination(20, TimeUnit.SECONDS);

    for (MyRunnable runnable : runnables) {
      assertNull(runnable.getException());
    }
  }