[PATCH] removing the finalize method from UnmarshallerImpl as it is not effective

  • From: Gareth Davis <gadavis@...>
  • To: "dev@..." <dev@...>
  • Subject: [PATCH] removing the finalize method from UnmarshallerImpl as it is not effective
  • Date: Mon, 16 Sep 2013 13:25:07 +0100
  • Accept-language: en-US
  • Acceptlanguage: en-US


The previous implementation called ClassFactory.clearCache() which in turn 
clears
the thread local cache. The flaw in this is that the finalize method is 
actually called
in the finalizer thread, thus attempting to clear thread local state in a 
finalize
method is pointless.

There is evidence that this under heavy use can effect the parallelism of the
garbage collector.

(http://mail.openjdk.java.net/pipermail/hotspot-gc-use/2013-September/001593.html)
---
 .../sun/xml/bind/v2/runtime/unmarshaller/UnmarshallerImpl.java | 10 
----------
 1 file changed, 10 deletions(-)

diff --git 
a/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/runtime/unmarshaller/UnmarshallerImpl.java
 
b/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/runtime/unmarshaller/UnmarshallerImpl.java
index d8e6f5c..b71d1e0 100644
--- 
a/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/runtime/unmarshaller/UnmarshallerImpl.java
+++ 
b/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/runtime/unmarshaller/UnmarshallerImpl.java
@@ -613,16 +613,6 @@ import org.xml.sax.helpers.DefaultHandler;
         return coordinator;
     }

-    @Override
-    @SuppressWarnings("FinalizeDeclaration")
-    protected void finalize() throws Throwable {
-        try {
-            ClassFactory.cleanCache();
-        } finally {
-            super.finalize();
-        }
-    }
-
     /**
      *  Must be called from same thread which created the UnmarshallerImpl 
instance.
      * @throws IOException
--
1.8.4

Attachment: 0001-removing-the-finalize-method-from-UnmarshallerImpl-a.patch
Description: 0001-removing-the-finalize-method-from-UnmarshallerImpl-a.patch



[PATCH] removing the finalize method from UnmarshallerImpl as it is not effective

Gareth Davis 09/16/2013

Re: [PATCH] removing the finalize method from UnmarshallerImpl as it is not effective

Gareth Davis 09/16/2013
Terms of Use; Privacy Policy; Copyright ©2013-2014 (revision 20140418.2d69abc)
 
 
Close
loading
Please Confirm
Close