BP
Size: a a a
BP
WT
WT
WD
ExecutorService executor = Executors.newFixedThreadPool(1);
Runnable worker = new ThreadRunner(numHost, channel, envelope, taskId, threadId, userId, iterCount);
executor.execute(worker);//calling execute method of ExecutorService
HelpMethods.awaitTerminationAfterShutdown(executor, 60000);
executor.shutdown();
public static void awaitTerminationAfterShutdown(ExecutorService threadPool, int seconds) {
threadPool.shutdown();
try {
if (!threadPool.awaitTermination(seconds, TimeUnit.SECONDS)) {
threadPool.shutdownNow();
}
} catch (InterruptedException ex) {
threadPool.shutdownNow();
Thread.currentThread().interrupt();
}
}
AE
AE
ch
AE
AE
N
AE
N
N
AE
N
AE
N