Does the future object returned by executorService.submit(Runnable) hold any reference to the runnable object?
问题 Let's assume we have the following code: List<Future<?>> runningTasks; ExecutorService executor; ... void executeTask(Runnable task){ runningTasks.add(executor.submit(task)); } My questions are: Does runningTasks hold a reference to the task object? How long does it hold it for? Does it still hold it after the task is complete? In order to avoid memory leaks do I have to take care to remove the future that was added to the list? 回答1: Until when the executor or the Future object holds a