summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2010-12-29 06:20:59 +0000
committerBrian S. O'Neill <bronee@gmail.com>2010-12-29 06:20:59 +0000
commit78d7662c467242277788d44a26d254707f19ae77 (patch)
tree62ae2a224a4f182f0e6e58486dd856b74c8ecd48 /src
parent39894a777bd166f9fbe5d8c329bac42e8c73b1d4 (diff)
Only start old evictor thread if needed.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/amazon/carbonado/util/SoftValuedCache.java24
1 files changed, 12 insertions, 12 deletions
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<K, V> {
private static class Impl<K, V> extends SoftValuedCache<K, V> {
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<K, V>[] mEntries;
private int mSize;
private int mThreshold;
@@ -400,20 +411,9 @@ public abstract class SoftValuedCache<K, V> {
}
}
- 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<T> extends SoftReference<T> {
Ref(T referent) {
- super(referent, cEvictor.mQueue);
+ super(referent, Impl.cEvictor.mQueue);
}
abstract void remove();