A DESCRIPTION OF THE REQUEST :
Theeadlocal is a good idea but can lead to memory leaks when used in a thread pool as there is no defined mechanism for removing all of the current thread's objects.
JUSTIFICATION :
Avoid more leaks!
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
static ThreadLocal tl = new ThreatLocal;
try {
// long section that uses tl
} finally {
tl.close();
}
Developers should NOT have to resort to the brilliant but excessive kludgery shown here:http://www.javaspecialists.eu/archive/Issue229.html
CUSTOMER SUBMITTED WORKAROUND :
http://www.javaspecialists.eu/archive/Issue229.html
Theeadlocal is a good idea but can lead to memory leaks when used in a thread pool as there is no defined mechanism for removing all of the current thread's objects.
JUSTIFICATION :
Avoid more leaks!
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
static ThreadLocal tl = new ThreatLocal;
try {
// long section that uses tl
} finally {
tl.close();
}
Developers should NOT have to resort to the brilliant but excessive kludgery shown here:http://www.javaspecialists.eu/archive/Issue229.html
CUSTOMER SUBMITTED WORKAROUND :
http://www.javaspecialists.eu/archive/Issue229.html
- duplicates
-
JDK-6558265 (thread) Using thread locals with thread pools may lead to unintentional object retention
- Open