Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Use Java ThreadLocal with caution

According to Oracle documentation, ThreadLocal is a class provides thread-local variables. These variables differ from their normal counterparts in that each thread that accesses one (via its get or set method) has its own, independently initialized copy of the variable. ThreadLocal instances are typically private static fields in classes that wish to associate state with a thread. In short, ThreadLocal variables are variables belong to a thread, not a class or an instance of a class.One common use of ThreadLocal is when you want to access some non thread-safe objects in threads without using ...

22,909 0       JAVA MEMORY LEAK THREADLOCAL