Here you can find the source of waitForCompletion(Future>[] futures)
Parameter | Description |
---|---|
futures | a parameter |
public static void waitForCompletion(Future<?>[] futures)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; public class Main { /**//from ww w.j a v a2s.co m * Waits for all threads to complete computation. * * @param futures */ public static void waitForCompletion(Future<?>[] futures) { int size = futures.length; try { for (int j = 0; j < size; j++) { futures[j].get(); } } catch (ExecutionException ex) { ex.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }