So, I create lets say 5 threads, and after completing their work, I would like to do another job. so how do you know when threads from an executor finish their work, and only after that they start the superload method?
Home:
ExecutorService executor = Executors.newFixedThreadPool(5); CountDownLatch doneSignal = new CountDownLatch(5);//thread number for(int i=0;i<5;i++){ getLogFile n = new getLogFile(doneSignal, i);// work method executor.execute(n); doneSignal.await(); }
// Probably something like executor.awaitTermination (60, TimeUnit.SECONDS); {doesn't work} or something that works
Superworkmethod(uses thread created files);
Grade:
public static class getLogFile implements Runnable { private final CountDownLatch doneSignal; private final int i; getLogFile(CountDownLatch doneSignal, int i) { this.doneSignal = doneSignal; this.i = i; } public int run1(String Filenamet) {
}
source share