8233958: Memory retention due to HttpsURLConnection finalizer that serves no purpose
authormichaelm
Wed, 13 Nov 2019 09:09:41 +0000
changeset 59047 6c78185c99d7
parent 59046 a8104278b4d0
child 59049 dc1899bb84c0
8233958: Memory retention due to HttpsURLConnection finalizer that serves no purpose Reviewed-by: dfuchs, rriggs
src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java
src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java
--- a/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java	Wed Nov 13 08:43:35 2019 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java	Wed Nov 13 09:09:41 2019 +0000
@@ -72,13 +72,4 @@
     protected javax.net.ssl.HostnameVerifier getHostnameVerifier() {
         return httpsURLConnection.getHostnameVerifier();
     }
-
-    /*
-     * Called by layered delegator's finalize() method to handle closing
-     * the underlying object.
-     */
-    @SuppressWarnings("deprecation")
-    protected void dispose() throws Throwable {
-        super.finalize();
-    }
 }
--- a/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Wed Nov 13 08:43:35 2019 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Wed Nov 13 09:09:41 2019 +0000
@@ -461,16 +461,6 @@
         delegate.setDefaultUseCaches(defaultusecaches);
     }
 
-    /*
-     * finalize (dispose) the delegated object.  Otherwise
-     * sun.net.www.protocol.http.HttpURLConnection's finalize()
-     * would have to be made public.
-     */
-    @SuppressWarnings("deprecation")
-    protected void finalize() throws Throwable {
-        delegate.dispose();
-    }
-
     public boolean equals(Object obj) {
         return this == obj || ((obj instanceof HttpsURLConnectionImpl) &&
             delegate.equals(((HttpsURLConnectionImpl)obj).delegate));