/* ** ThreadLocal do not support inheritance
* add by duyang 06 28 2019
*/
Public class ThreadLocalTest {
/* *
* InheritableThreadLocal child thread can access the parent thread variables;
*/
//private static ThreadLocalAre=new ThreadLocal<> (a);
Public static void main (String [] args) throws InterruptedException {
ThreadLocalAre=new ThreadLocal<> (a);
Are set (called "lian");
System. The gc ();
System. Out. Println (Thread. CurrentThread () + "" + are the get ());
//delete ThreadLocal
//are. Remove ();
}
}
16 lines of code and what value that GC no recycling ThreadLocal? Have a great god to
CodePudding user response:
Execution System. The role of the gc () function is just to remind or tell the virtual machine, wants a garbage collection, as to when to recycle depends on the virtual machine, and there is no guarantee that a certain recycle