diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2010-12-29 06:20:59 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2010-12-29 06:20:59 +0000 |
commit | 78d7662c467242277788d44a26d254707f19ae77 (patch) | |
tree | 62ae2a224a4f182f0e6e58486dd856b74c8ecd48 /src/main/java/com/amazon/carbonado | |
parent | 39894a777bd166f9fbe5d8c329bac42e8c73b1d4 (diff) |
Only start old evictor thread if needed.
Diffstat (limited to 'src/main/java/com/amazon/carbonado')
-rw-r--r-- | src/main/java/com/amazon/carbonado/util/SoftValuedCache.java | 24 |
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();
|