From b66fb3db6951b2b6d3ace72ca3e197c7c2048e86 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Thu, 18 Dec 2008 20:58:00 +0000 Subject: Fixes for excessive class generation and memory usage when opening multiple repositories. --- .../repo/indexed/IndexEntryGenerator.java | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/repo/indexed') diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexEntryGenerator.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexEntryGenerator.java index a126224..7fb80dc 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexEntryGenerator.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexEntryGenerator.java @@ -28,6 +28,7 @@ import com.amazon.carbonado.Storable; import com.amazon.carbonado.SupportException; import com.amazon.carbonado.info.StorableIndex; import com.amazon.carbonado.info.StorableProperty; +import com.amazon.carbonado.synthetic.SyntheticStorableReferenceAccess; import com.amazon.carbonado.synthetic.SyntheticStorableReferenceBuilder; /** @@ -100,7 +101,7 @@ class IndexEntryGenerator { } } - private SyntheticStorableReferenceBuilder mBuilder; + private SyntheticStorableReferenceAccess mIndexAccess; /** * Convenience class for gluing new "builder" style synthetics to the traditional @@ -112,13 +113,17 @@ class IndexEntryGenerator { // but we have nothing better available to us Class type = index.getProperty(0).getEnclosingType(); - mBuilder = new SyntheticStorableReferenceBuilder(type, index.isUnique()); + SyntheticStorableReferenceBuilder builder = + new SyntheticStorableReferenceBuilder(type, index.isUnique()); for (int i=0; i { * @return class of index entry, which is a custom Storable */ public Class getIndexEntryClass() { - return mBuilder.getStorableClass(); + return mIndexAccess.getReferenceClass(); } /** @@ -138,7 +143,7 @@ class IndexEntryGenerator { * @param master master whose primary key properties will be set */ public void copyToMasterPrimaryKey(Storable indexEntry, S master) { - mBuilder.copyToMasterPrimaryKey(indexEntry, master); + mIndexAccess.copyToMasterPrimaryKey(indexEntry, master); } /** @@ -149,7 +154,7 @@ class IndexEntryGenerator { * @param master source of property values */ public void copyFromMaster(Storable indexEntry, S master) { - mBuilder.copyFromMaster(indexEntry, master); + mIndexAccess.copyFromMaster(indexEntry, master); } /** @@ -161,13 +166,13 @@ class IndexEntryGenerator { * @param master source of property values */ public boolean isConsistent(Storable indexEntry, S master) { - return mBuilder.isConsistent(indexEntry, master); + return mIndexAccess.isConsistent(indexEntry, master); } /** * Returns a comparator for ordering index entries. */ public Comparator getComparator() { - return mBuilder.getComparator(); + return mIndexAccess.getComparator(); } } -- cgit v1.2.3