# HG changeset patch # User chegar # Date 1296727811 0 # Node ID 7599e778785f05c3608e847d41a6ed5aac763dce # Parent 13423c0952ad7b67d5afefbcd4e0cb3920b8c9a0 7008595: Class loader leak caused by keepAliveTimer thread in KeepAliveCache Reviewed-by: michaelm diff -r 13423c0952ad -r 7599e778785f jdk/src/share/classes/sun/net/www/http/KeepAliveCache.java --- a/jdk/src/share/classes/sun/net/www/http/KeepAliveCache.java Wed Feb 02 13:13:34 2011 -0500 +++ b/jdk/src/share/classes/sun/net/www/http/KeepAliveCache.java Thu Feb 03 10:10:11 2011 +0000 @@ -106,6 +106,9 @@ keepAliveTimer = new Thread(grp, cache, "Keep-Alive-Timer"); keepAliveTimer.setDaemon(true); keepAliveTimer.setPriority(Thread.MAX_PRIORITY - 2); + // Set the context class loader to null in order to avoid + // keeping a strong reference to an application classloader. + keepAliveTimer.setContextClassLoader(null); keepAliveTimer.start(); return null; } diff -r 13423c0952ad -r 7599e778785f jdk/src/share/classes/sun/net/www/http/KeepAliveStream.java --- a/jdk/src/share/classes/sun/net/www/http/KeepAliveStream.java Wed Feb 02 13:13:34 2011 -0500 +++ b/jdk/src/share/classes/sun/net/www/http/KeepAliveStream.java Thu Feb 03 10:10:11 2011 +0000 @@ -185,6 +185,9 @@ cleanerThread = new Thread(grp, queue, "Keep-Alive-SocketCleaner"); cleanerThread.setDaemon(true); cleanerThread.setPriority(Thread.MAX_PRIORITY - 2); + // Set the context class loader to null in order to avoid + // keeping a strong reference to an application classloader. + cleanerThread.setContextClassLoader(null); cleanerThread.start(); return null; }