How to ensure garbage collection of a FutureTask that is submitted to a ThreadPoolExecutor and then cancelled?
问题 I am submitting Callable objects to a ThreadPoolExecutor and they seem to be sticking around in memory. Looking at the heap dump with the MAT tool for Eclipse see that the Callable objects are being referenced by a FutureTask$Sync 's callable variable. That FutureTask$Sync is referenced by a FutureTask 's sync variable. That FutureTask is referenced by the FutureTask$Sync 's this$0 variable. I have read around about this (here, here, and on SO) and it seems like the FutureTask that the