From ab92f4ec859413b2d3612068dfb21d741fb389a3 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 6 May 2008 13:52:12 +0000 Subject: Code cleanup: add @Override annotations, remove unused imports, remove dead code and add @Deprecated annotations. --- src/main/java/com/amazon/carbonado/repo/map/MapCursor.java | 1 - src/main/java/com/amazon/carbonado/repo/map/MapRepository.java | 5 +++++ src/main/java/com/amazon/carbonado/repo/map/MapStorage.java | 10 ---------- .../java/com/amazon/carbonado/repo/map/MapTransaction.java | 4 +++- .../com/amazon/carbonado/repo/map/MapTransactionManager.java | 5 +++++ .../java/com/amazon/carbonado/repo/map/UpgradableLock.java | 2 +- 6 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/repo/map') diff --git a/src/main/java/com/amazon/carbonado/repo/map/MapCursor.java b/src/main/java/com/amazon/carbonado/repo/map/MapCursor.java index cd0f7e3..006fd46 100644 --- a/src/main/java/com/amazon/carbonado/repo/map/MapCursor.java +++ b/src/main/java/com/amazon/carbonado/repo/map/MapCursor.java @@ -25,7 +25,6 @@ import java.util.NoSuchElementException; import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; import com.amazon.carbonado.FetchException; -import com.amazon.carbonado.IsolationLevel; import com.amazon.carbonado.Storable; import com.amazon.carbonado.cursor.AbstractCursor; diff --git a/src/main/java/com/amazon/carbonado/repo/map/MapRepository.java b/src/main/java/com/amazon/carbonado/repo/map/MapRepository.java index 2e82f89..99b0e3b 100644 --- a/src/main/java/com/amazon/carbonado/repo/map/MapRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/map/MapRepository.java @@ -88,24 +88,29 @@ class MapRepository extends AbstractRepository return ((MapStorage) storageFor(storableType)).getIndexInfo(); } + @Override protected Log getLog() { return null; } + @Override protected TransactionManager transactionManager() { return mTxnManager; } + @Override protected TransactionScope localTransactionScope() { return mTxnManager.localScope(); } + @Override protected Storage createStorage(Class type) throws RepositoryException { return new MapStorage(this, type, mLockTimeout, mLockTimeoutUnit); } + @Override protected SequenceValueProducer createSequenceValueProducer(String name) throws RepositoryException { diff --git a/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java b/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java index 520d18c..c8a6e9c 100644 --- a/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java +++ b/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java @@ -23,22 +23,16 @@ import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.EnumSet; -import java.util.Iterator; import java.util.List; import java.util.NavigableMap; -import java.util.Set; - import java.util.concurrent.ConcurrentNavigableMap; import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.TimeUnit; -import org.cojen.classfile.TypeDesc; - import com.amazon.carbonado.Cursor; import com.amazon.carbonado.FetchException; import com.amazon.carbonado.FetchInterruptedException; import com.amazon.carbonado.FetchTimeoutException; -import com.amazon.carbonado.IsolationLevel; import com.amazon.carbonado.PersistException; import com.amazon.carbonado.PersistInterruptedException; import com.amazon.carbonado.PersistTimeoutException; @@ -71,15 +65,11 @@ import com.amazon.carbonado.gen.MasterFeature; import com.amazon.carbonado.util.QuickConstructorGenerator; -import com.amazon.carbonado.filter.Filter; - -import com.amazon.carbonado.info.ChainedProperty; import com.amazon.carbonado.info.Direction; import com.amazon.carbonado.info.OrderedProperty; import com.amazon.carbonado.info.StorableIndex; import com.amazon.carbonado.info.StorableInfo; import com.amazon.carbonado.info.StorableIntrospector; -import com.amazon.carbonado.info.StorableProperty; import com.amazon.carbonado.qe.BoundaryType; import com.amazon.carbonado.qe.QueryExecutorFactory; diff --git a/src/main/java/com/amazon/carbonado/repo/map/MapTransaction.java b/src/main/java/com/amazon/carbonado/repo/map/MapTransaction.java index 93bcbdc..2857d31 100644 --- a/src/main/java/com/amazon/carbonado/repo/map/MapTransaction.java +++ b/src/main/java/com/amazon/carbonado/repo/map/MapTransaction.java @@ -33,7 +33,6 @@ import com.amazon.carbonado.PersistException; import com.amazon.carbonado.PersistInterruptedException; import com.amazon.carbonado.PersistTimeoutException; import com.amazon.carbonado.Storable; -import com.amazon.carbonado.Storage; /** * @@ -127,6 +126,7 @@ class MapTransaction { storage.mapRemove(key); } + @Override public String toString() { return "undo insert by remove: " + key; } @@ -142,6 +142,7 @@ class MapTransaction { storage.mapPut(old); } + @Override public String toString() { return "undo update by put: " + old; } @@ -157,6 +158,7 @@ class MapTransaction { storage.mapPut(old); } + @Override public String toString() { return "undo delete by put: " + old; } diff --git a/src/main/java/com/amazon/carbonado/repo/map/MapTransactionManager.java b/src/main/java/com/amazon/carbonado/repo/map/MapTransactionManager.java index 5598353..929ab17 100644 --- a/src/main/java/com/amazon/carbonado/repo/map/MapTransactionManager.java +++ b/src/main/java/com/amazon/carbonado/repo/map/MapTransactionManager.java @@ -40,6 +40,7 @@ class MapTransactionManager extends TransactionManager { mLockTimeoutUnit = lockTimeoutUnit; } + @Override protected IsolationLevel selectIsolationLevel(Transaction parent, IsolationLevel level) { if (level == null) { if (parent == null) { @@ -63,10 +64,12 @@ class MapTransactionManager extends TransactionManager { } } + @Override protected boolean supportsForUpdate() { return true; } + @Override protected MapTransaction createTxn(MapTransaction parent, IsolationLevel level) throws Exception { @@ -87,11 +90,13 @@ class MapTransactionManager extends TransactionManager { return new MapTransaction(parent, level, timeout, unit); } + @Override protected boolean commitTxn(MapTransaction txn) throws PersistException { txn.commit(); return false; } + @Override protected void abortTxn(MapTransaction txn) throws PersistException { txn.abort(); } diff --git a/src/main/java/com/amazon/carbonado/repo/map/UpgradableLock.java b/src/main/java/com/amazon/carbonado/repo/map/UpgradableLock.java index e4e8a56..55074e1 100644 --- a/src/main/java/com/amazon/carbonado/repo/map/UpgradableLock.java +++ b/src/main/java/com/amazon/carbonado/repo/map/UpgradableLock.java @@ -384,7 +384,6 @@ class UpgradableLock { * @param locker object trying to become lock owner */ public final void lockForWrite(L locker) { - Result writeResult; if (!tryLockForWrite(locker)) { Result upgradeResult = lockForUpgrade_(locker); if (!tryLockForWrite(locker)) { @@ -506,6 +505,7 @@ class UpgradableLock { } } + @Override public String toString() { int state = mState; int readLocks = state & ~LOCK_STATE_MASK; -- cgit v1.2.3