I am working on at the moment on a program that uses a lot of threads.
A- My question is related to freeing up the executors once they have shut down for garbage collecting, what is the best way? I have read somewhere that I have to access the Future (Runnable or Callable) and affect it null for the garbage collector to pick it up.is that true?
B- Same question goes for thre开发者_开发技巧adpools?
Thanks for your help,
If there is no reference to the Executor Service
anymore this should be done automatically.
Resources of inner Thread CallAble or Runnable are enabled to GC after it compleate, except resource which they return.
If you want force to run GC. You should call:
System.qc();
Then GC will start his work in background.
精彩评论