From 4de0964ee46a9b86f8ad0ec2bb85ed687f844320 Mon Sep 17 00:00:00 2001 From: Gareth Davis Date: Mon, 16 Sep 2013 10:51:07 +0100 Subject: [PATCH] removing the finalize method from UnmarshallerImpl as it is not effective 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