diff options
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo/jdbc')
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java | 7 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java index e929e6b..e40ce04 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java @@ -43,7 +43,6 @@ import org.cojen.classfile.Opcode; import org.cojen.classfile.TypeDesc;
import org.cojen.util.ClassInjector;
import org.cojen.util.KeyFactory;
-import org.cojen.util.SoftValuedHashMap;
import org.joda.time.ReadableInstant;
@@ -65,6 +64,8 @@ import com.amazon.carbonado.gen.StorableGenerator; import com.amazon.carbonado.gen.TriggerSupport;
import static com.amazon.carbonado.gen.CommonMethodNames.*;
+import com.amazon.carbonado.util.SoftValuedCache;
+
/**
* Generates concrete implementations of {@link Storable} types for
* {@link JDBCRepository}.
@@ -87,10 +88,10 @@ class JDBCStorableGenerator<S extends Storable> { private static final int INITIAL_VERSION = 2;
private static final int INCREMENT_VERSION = 3;
- private static final Map<Object, Class<? extends Storable>> cCache;
+ private static final SoftValuedCache<Object, Class<? extends Storable>> cCache;
static {
- cCache = new SoftValuedHashMap();
+ cCache = SoftValuedCache.newCache(11);
}
static <S extends Storable> Class<? extends S> getGeneratedClass(JDBCStorableInfo<S> info,
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java index 042974f..acba43e 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java @@ -46,7 +46,6 @@ import org.apache.commons.logging.LogFactory; import org.cojen.classfile.TypeDesc;
import org.cojen.util.KeyFactory;
-import org.cojen.util.SoftValuedHashMap;
import org.cojen.util.ThrowUnchecked;
import com.amazon.carbonado.capability.IndexInfo;
@@ -66,6 +65,8 @@ import com.amazon.carbonado.info.StorableProperty; import com.amazon.carbonado.info.StorablePropertyAdapter;
import com.amazon.carbonado.info.StorablePropertyConstraint;
+import com.amazon.carbonado.util.SoftValuedCache;
+
/**
* Provides additional metadata for a {@link Storable} type needed by
* JDBCRepository. The storable type must match to a table in an external
@@ -80,7 +81,8 @@ import com.amazon.carbonado.info.StorablePropertyConstraint; public class JDBCStorableIntrospector extends StorableIntrospector {
// Maps compound keys to softly referenced JDBCStorableInfo objects.
@SuppressWarnings("unchecked")
- private static Map<Object, JDBCStorableInfo<?>> cCache = new SoftValuedHashMap();
+ private static SoftValuedCache<Object, JDBCStorableInfo<?>> cCache =
+ SoftValuedCache.newCache(11);
/**
* Examines the given class and returns a JDBCStorableInfo describing it. A
|