--- old/src/java.base/share/classes/java/lang/ref/Reference.java 2016-02-07 22:49:24.330524495 +0100 +++ new/src/java.base/share/classes/java/lang/ref/Reference.java 2016-02-07 22:49:24.227526327 +0100 @@ -29,7 +29,6 @@ import jdk.internal.HotSpotIntrinsicCandidate; import jdk.internal.misc.JavaLangRefAccess; import jdk.internal.misc.SharedSecrets; -import jdk.internal.ref.Cleaner; /** * Abstract base class for reference objects. This class defines the @@ -139,11 +138,10 @@ } static { - // pre-load and initialize InterruptedException and Cleaner classes + // pre-load and initialize InterruptedException class // so that we don't get into trouble later in the run loop if there's - // memory shortage while loading/initializing them lazily. + // memory shortage while loading/initializing it lazily. ensureClassInitialized(InterruptedException.class); - ensureClassInitialized(Cleaner.class); } ReferenceHandler(ThreadGroup g, String name) { @@ -175,14 +173,10 @@ */ static boolean tryHandlePending(boolean waitForNotify) { Reference r; - Cleaner c; try { synchronized (lock) { - if (pending != null) { - r = pending; - // 'instanceof' might throw OutOfMemoryError sometimes - // so do this before un-linking 'r' from the 'pending' chain... - c = r instanceof Cleaner ? (Cleaner) r : null; + r = pending; + if (r != null) { // unlink 'r' from 'pending' chain pending = r.discovered; r.discovered = null; @@ -209,12 +203,6 @@ return true; } - // Fast path for cleaners - if (c != null) { - c.clean(); - return true; - } - ReferenceQueue q = r.queue; if (q != ReferenceQueue.NULL) q.enqueue(r); return true;