Java tutorial
//package com.java2s; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; public class Main { private static List<WeakReference<ExecutorService>> executorList = new ArrayList<>(); /** * Questo metodo statico serve per tracciare un ExecutorService per la chiusura * @param exs ExecutorService da tracciare * @return l'ExecutorService tracciato */ public synchronized static ExecutorService TrackExecutorService(ExecutorService exs) { executorList.add(new WeakReference<ExecutorService>(exs)); return exs; } }