【发布时间】:2012-12-17 18:41:59
【问题描述】:
我正在使用ExecutorService 进行如下连接任务:
ExecutorService executor = Executors.newSingleThreadExecutor();
Future<ApplicationConnection> future = (Future<ApplicationConnection>) executor.submit(new ConnectThread(crf, connoptions));
connection = future.get(300000, TimeUnit.SECONDS);
executor.shutdownNow();
call() 方法调用.connect() 方法(专有 API)。这种连接方法会产生各种线程池等。我担心的是,如果将来超时并杀死执行程序,将来可能已经通过调用.connect() 方法产生的线程也会结束吗?我知道杀死一个线程也会杀死任何子线程,但这是否遵循相同的逻辑?
【问题讨论】:
标签: java multithreading executorservice