7008595: Class loader leak caused by keepAliveTimer thread in KeepAliveCache
Reviewed-by: michaelm
--- 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;
}
--- 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;
}