From 78d7662c467242277788d44a26d254707f19ae77 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Wed, 29 Dec 2010 06:20:59 +0000 Subject: Only start old evictor thread if needed. --- .../com/amazon/carbonado/util/SoftValuedCache.java | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/amazon/carbonado/util/SoftValuedCache.java b/src/main/java/com/amazon/carbonado/util/SoftValuedCache.java index c1562a6..937d379 100644 --- a/src/main/java/com/amazon/carbonado/util/SoftValuedCache.java +++ b/src/main/java/com/amazon/carbonado/util/SoftValuedCache.java @@ -128,6 +128,17 @@ public abstract class SoftValuedCache { private static class Impl extends SoftValuedCache { private static final float LOAD_FACTOR = 0.75f; + final static Evictor cEvictor; + + static { + Evictor evictor = new Evictor(); + evictor.setName("SoftValuedCache Evictor"); + evictor.setDaemon(true); + evictor.setPriority(Thread.MAX_PRIORITY); + evictor.start(); + cEvictor = evictor; + } + private Entry[] mEntries; private int mSize; private int mThreshold; @@ -400,20 +411,9 @@ public abstract class SoftValuedCache { } } - final static Evictor cEvictor; - - static { - Evictor evictor = new Evictor(); - evictor.setName("SoftValuedCache Evictor"); - evictor.setDaemon(true); - evictor.setPriority(Thread.MAX_PRIORITY); - evictor.start(); - cEvictor = evictor; - } - private static abstract class Ref extends SoftReference { Ref(T referent) { - super(referent, cEvictor.mQueue); + super(referent, Impl.cEvictor.mQueue); } abstract void remove(); -- cgit v1.2.3