Java tutorial
//package com.java2s; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; public class Main { private static final List<WeakReference<Thread>> threadList = new ArrayList<>(); public static synchronized Thread createTrackThread(Runnable run) { Thread t = new Thread(run); threadList.add(new WeakReference<>(t)); return t; } }