changeset 3480:3c86f24f7500

7008595: Class loader leak caused by keepAliveTimer thread in KeepAliveCache Reviewed-by: michaelm
author chegar
date Thu, 03 Feb 2011 10:10:11 +0000
parents 25462d7eee24
children dff9b6d18628
files src/share/classes/sun/net/www/http/KeepAliveCache.java src/share/classes/sun/net/www/http/KeepAliveStream.java
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/net/www/http/KeepAliveCache.java	Wed Feb 02 13:13:34 2011 -0500
+++ b/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/src/share/classes/sun/net/www/http/KeepAliveStream.java	Wed Feb 02 13:13:34 2011 -0500
+++ b/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;
                     }