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. --- .../com/amazon/carbonado/repo/sleepycat/BDBCursor.java | 15 +++++++++++++++ .../amazon/carbonado/repo/sleepycat/BDBRepository.java | 9 +++++++++ .../carbonado/repo/sleepycat/BDBRepositoryBuilder.java | 1 + .../com/amazon/carbonado/repo/sleepycat/BDBStorage.java | 2 -- .../carbonado/repo/sleepycat/BDBTransactionManager.java | 5 +++++ 5 files changed, 30 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/repo/sleepycat') diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBCursor.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBCursor.java index b2a1f32..a0dfe38 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBCursor.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBCursor.java @@ -76,6 +76,7 @@ abstract class BDBCursor extends RawCursor { } } + @Override public void close() throws FetchException { try { super.close(); @@ -84,6 +85,7 @@ abstract class BDBCursor extends RawCursor { } } + @Override protected void release() throws FetchException { try { cursor_close(); @@ -92,6 +94,7 @@ abstract class BDBCursor extends RawCursor { } } + @Override protected byte[] getCurrentKey() throws FetchException { if (searchKey_getPartial()) { throw new IllegalStateException(); @@ -99,6 +102,7 @@ abstract class BDBCursor extends RawCursor { return searchKey_getDataCopy(); } + @Override protected byte[] getCurrentValue() throws FetchException { if (data_getPartial()) { throw new IllegalStateException(); @@ -106,15 +110,18 @@ abstract class BDBCursor extends RawCursor { return data_getDataCopy(); } + @Override protected void disableKeyAndValue() { searchKey_setPartial(true); data_setPartial(true); } + @Override protected void disableValue() { data_setPartial(true); } + @Override protected void enableKeyAndValue() throws FetchException { searchKey_setPartial(false); data_setPartial(false); @@ -131,10 +138,12 @@ abstract class BDBCursor extends RawCursor { } } + @Override protected S instantiateCurrent() throws FetchException { return mStorage.instantiate(primaryKey_getData(), data_getData()); } + @Override protected boolean toFirst() throws FetchException { try { return cursor_getFirst(); @@ -143,6 +152,7 @@ abstract class BDBCursor extends RawCursor { } } + @Override protected boolean toFirst(byte[] key) throws FetchException { try { searchKey_setData(key); @@ -152,6 +162,7 @@ abstract class BDBCursor extends RawCursor { } } + @Override protected boolean toLast() throws FetchException { try { return cursor_getLast(); @@ -160,6 +171,7 @@ abstract class BDBCursor extends RawCursor { } } + @Override protected boolean toLast(byte[] key) throws FetchException { try { // BDB cursor doesn't support "search for exact or less than", so @@ -209,6 +221,7 @@ abstract class BDBCursor extends RawCursor { } } + @Override protected boolean toNext() throws FetchException { try { return cursor_getNext(); @@ -217,6 +230,7 @@ abstract class BDBCursor extends RawCursor { } } + @Override protected boolean toPrevious() throws FetchException { try { return cursor_getPrev(); @@ -254,6 +268,7 @@ abstract class BDBCursor extends RawCursor { return newData; } + @Override protected void handleNoSuchElement() throws FetchException { // Might not be any more elements because storage is closed. mStorage.checkClosed(); diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java index 6fd9cc1..eeb8e9a 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java @@ -160,6 +160,7 @@ abstract class BDBRepository extends AbstractRepository mFileNameMap = builder.getFileNameMap(); } + @Override @SuppressWarnings("unchecked") public C getCapability(Class capabilityType) { C cap = super.getCapability(capabilityType); @@ -279,6 +280,7 @@ abstract class BDBRepository extends AbstractRepository close(); } + @Override protected void shutdownHook() { // Run any external shutdown logic that needs to happen before the // databases and the environment are actually closed @@ -327,10 +329,12 @@ abstract class BDBRepository extends AbstractRepository } } + @Override protected Log getLog() { return mLog; } + @Override protected Storage createStorage(Class type) throws RepositoryException { @@ -341,6 +345,7 @@ abstract class BDBRepository extends AbstractRepository } } + @Override protected SequenceValueProducer createSequenceValueProducer(String name) throws RepositoryException { @@ -528,10 +533,12 @@ abstract class BDBRepository extends AbstractRepository return mExTransformer.toRepositoryException(e); } + @Override protected final TransactionManager transactionManager() { return mTxnMgr; } + @Override protected final TransactionScope localTransactionScope() { return mTxnMgr.localScope(); } @@ -575,6 +582,7 @@ abstract class BDBRepository extends AbstractRepository mMinutes = minutes; } + @Override public void run() { try { while (true) { @@ -711,6 +719,7 @@ abstract class BDBRepository extends AbstractRepository mSleepInterval = sleepInterval; } + @Override public void run() { while (true) { try { diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java index 995fada..f60511f 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java @@ -748,6 +748,7 @@ public class BDBRepositoryBuilder extends AbstractRepositoryBuilder { return (long) (seconds * 1000000); } + @Override public void errorCheck(Collection messages) throws ConfigurationException { super.errorCheck(messages); diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java index be5982b..45205c7 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBStorage.java @@ -22,8 +22,6 @@ import java.util.Collection; import java.util.Collections; import java.util.Map; -import org.apache.commons.logging.LogFactory; - import org.cojen.classfile.TypeDesc; import com.amazon.carbonado.Cursor; diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java index 5e0af3b..1e613ca 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java @@ -45,14 +45,17 @@ class BDBTransactionManager extends TransactionManager { mRepositoryRef = new WeakReference>(repository); } + @Override protected IsolationLevel selectIsolationLevel(Transaction parent, IsolationLevel level) { return repository().selectIsolationLevel(parent, level); } + @Override protected boolean supportsForUpdate() { return true; } + @Override protected Txn createTxn(Txn parent, IsolationLevel level) throws Exception { if (level == IsolationLevel.NONE) { return null; @@ -74,6 +77,7 @@ class BDBTransactionManager extends TransactionManager { } } + @Override protected boolean commitTxn(Txn txn) throws PersistException { try { repository().txn_commit(txn); @@ -83,6 +87,7 @@ class BDBTransactionManager extends TransactionManager { } } + @Override protected void abortTxn(Txn txn) throws PersistException { try { repository().txn_abort(txn); -- cgit v1.2.3