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/spi/AbstractRepository.java | 5 +++-- .../java/com/amazon/carbonado/spi/BelatedRepositoryCreator.java | 3 +++ src/main/java/com/amazon/carbonado/spi/BelatedStorageCreator.java | 3 +++ src/main/java/com/amazon/carbonado/spi/BlobProperty.java | 2 ++ src/main/java/com/amazon/carbonado/spi/ClobProperty.java | 2 ++ src/main/java/com/amazon/carbonado/spi/IndexInfoImpl.java | 1 + src/main/java/com/amazon/carbonado/spi/LobEngine.java | 2 ++ src/main/java/com/amazon/carbonado/spi/LobEngineTrigger.java | 7 +++++++ src/main/java/com/amazon/carbonado/spi/RAFInputStream.java | 5 +++++ src/main/java/com/amazon/carbonado/spi/RAFOutputStream.java | 4 ++++ src/main/java/com/amazon/carbonado/spi/RepairExecutor.java | 2 ++ src/main/java/com/amazon/carbonado/spi/StoragePool.java | 1 + src/main/java/com/amazon/carbonado/spi/StoredSequence.java | 1 + 13 files changed, 36 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/spi') diff --git a/src/main/java/com/amazon/carbonado/spi/AbstractRepository.java b/src/main/java/com/amazon/carbonado/spi/AbstractRepository.java index 191f94e..6bf09bc 100644 --- a/src/main/java/com/amazon/carbonado/spi/AbstractRepository.java +++ b/src/main/java/com/amazon/carbonado/spi/AbstractRepository.java @@ -21,8 +21,6 @@ package com.amazon.carbonado.spi; import java.lang.ref.WeakReference; import java.util.Collection; -import java.util.Map; - import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -72,6 +70,7 @@ public abstract class AbstractRepository mShutdownLock = new ReentrantReadWriteLock(); mStoragePool = new StoragePool() { + @Override protected Storage createStorage(Class type) throws RepositoryException { @@ -85,6 +84,7 @@ public abstract class AbstractRepository }; mSequencePool = new SequenceValueProducerPool() { + @Override protected SequenceValueProducer createSequenceValueProducer(String name) throws RepositoryException { @@ -297,6 +297,7 @@ public abstract class AbstractRepository mRepository = new WeakReference>(repository); } + @Override public void run() { run(true); } diff --git a/src/main/java/com/amazon/carbonado/spi/BelatedRepositoryCreator.java b/src/main/java/com/amazon/carbonado/spi/BelatedRepositoryCreator.java index 37e62d0..b5676a4 100644 --- a/src/main/java/com/amazon/carbonado/spi/BelatedRepositoryCreator.java +++ b/src/main/java/com/amazon/carbonado/spi/BelatedRepositoryCreator.java @@ -78,6 +78,7 @@ public class BelatedRepositoryCreator extends BelatedCreator mStorableType = storableType; } + @Override protected Storage createReal() throws SupportException { Exception error; try { @@ -86,10 +87,12 @@ public class BelatedStorageCreator return null; } + @Override protected Storage createBogus() { return new BogusStorage(); } + @Override protected void timedOutNotification(long timedOutMillis) { mLog.error("Timed out waiting to get Storage of type \"" + mStorableType.getName() + "\" after waiting " + timedOutMillis + " milliseconds"); diff --git a/src/main/java/com/amazon/carbonado/spi/BlobProperty.java b/src/main/java/com/amazon/carbonado/spi/BlobProperty.java index b4ea500..40c77f3 100644 --- a/src/main/java/com/amazon/carbonado/spi/BlobProperty.java +++ b/src/main/java/com/amazon/carbonado/spi/BlobProperty.java @@ -37,10 +37,12 @@ class BlobProperty extends LobProperty { super(engine, propertyName); } + @Override Blob createNewLob(int blockSize) throws PersistException { return mEngine.createNewBlob(blockSize); } + @Override void setLobValue(long locator, Blob data) throws PersistException { try { mEngine.setBlobValue(locator, data); diff --git a/src/main/java/com/amazon/carbonado/spi/ClobProperty.java b/src/main/java/com/amazon/carbonado/spi/ClobProperty.java index dc9d196..64b18ec 100644 --- a/src/main/java/com/amazon/carbonado/spi/ClobProperty.java +++ b/src/main/java/com/amazon/carbonado/spi/ClobProperty.java @@ -37,10 +37,12 @@ class ClobProperty extends LobProperty { super(engine, propertyName); } + @Override Clob createNewLob(int blockSize) throws PersistException { return mEngine.createNewClob(blockSize); } + @Override void setLobValue(long locator, Clob data) throws PersistException { try { mEngine.setClobValue(locator, data); diff --git a/src/main/java/com/amazon/carbonado/spi/IndexInfoImpl.java b/src/main/java/com/amazon/carbonado/spi/IndexInfoImpl.java index de16f75..fad8415 100644 --- a/src/main/java/com/amazon/carbonado/spi/IndexInfoImpl.java +++ b/src/main/java/com/amazon/carbonado/spi/IndexInfoImpl.java @@ -101,6 +101,7 @@ public class IndexInfoImpl implements IndexInfo { return mPropertyDirections.clone(); } + @Override public String toString() { StringBuilder b = new StringBuilder(); b.append("IndexInfo {name="); diff --git a/src/main/java/com/amazon/carbonado/spi/LobEngine.java b/src/main/java/com/amazon/carbonado/spi/LobEngine.java index e6fcb07..575ca1d 100644 --- a/src/main/java/com/amazon/carbonado/spi/LobEngine.java +++ b/src/main/java/com/amazon/carbonado/spi/LobEngine.java @@ -685,6 +685,7 @@ public class LobEngine { super(new BlobImpl(lob)); } + @Override public Long getLocator() { return ((BlobImpl) super.getWrappedBlob()).getLocator(); } @@ -711,6 +712,7 @@ public class LobEngine { } // Override to gain permission. + @Override protected BlobImpl getWrappedBlob() { return (BlobImpl) super.getWrappedBlob(); } diff --git a/src/main/java/com/amazon/carbonado/spi/LobEngineTrigger.java b/src/main/java/com/amazon/carbonado/spi/LobEngineTrigger.java index d278556..8d5ccd2 100644 --- a/src/main/java/com/amazon/carbonado/spi/LobEngineTrigger.java +++ b/src/main/java/com/amazon/carbonado/spi/LobEngineTrigger.java @@ -49,6 +49,7 @@ class LobEngineTrigger extends Trigger { } // Returns user specified Lob values + @Override public Object beforeInsert(S storable) throws PersistException { // Capture user lob values for later and replace with new locators. int length = mLobProperties.length; @@ -65,6 +66,7 @@ class LobEngineTrigger extends Trigger { return userLobs; } + @Override public void afterInsert(S storable, Object state) throws PersistException { // Save user lob value contents into new lobs. This is done after the // insert of the enclosing record to avoid an expensive rollback if a @@ -81,10 +83,12 @@ class LobEngineTrigger extends Trigger { } } + @Override public void failedInsert(S storable, Object state) { unreplaceLobs(storable, state); } + @Override public Object beforeUpdate(S storable) throws PersistException { // For each dirty lob property, capture it in case update fails. All // lob updates are made in this method. @@ -129,11 +133,13 @@ class LobEngineTrigger extends Trigger { return userLobs; } + @Override public void failedUpdate(S storable, Object state) { unreplaceLobs(storable, state); } // Returns existing Storable or null + @Override public Object beforeDelete(S storable) throws PersistException { S existing = (S) storable.copy(); try { @@ -146,6 +152,7 @@ class LobEngineTrigger extends Trigger { } } + @Override public void afterDelete(S storable, Object existing) throws PersistException { if (existing != null) { // After successful delete of master storable, delete all the lobs. diff --git a/src/main/java/com/amazon/carbonado/spi/RAFInputStream.java b/src/main/java/com/amazon/carbonado/spi/RAFInputStream.java index c13763e..a0fe41a 100644 --- a/src/main/java/com/amazon/carbonado/spi/RAFInputStream.java +++ b/src/main/java/com/amazon/carbonado/spi/RAFInputStream.java @@ -37,18 +37,22 @@ public class RAFInputStream extends InputStream { mRAF = raf; } + @Override public int read() throws IOException { return mRAF.read(); } + @Override public int read(byte[] b) throws IOException { return mRAF.read(b); } + @Override public int read(byte[] b, int offset, int length) throws IOException { return mRAF.read(b, offset, length); } + @Override public long skip(long n) throws IOException { if (n > Integer.MAX_VALUE) { n = Integer.MAX_VALUE; @@ -56,6 +60,7 @@ public class RAFInputStream extends InputStream { return mRAF.skipBytes((int) n); } + @Override public void close() throws IOException { mRAF.close(); } diff --git a/src/main/java/com/amazon/carbonado/spi/RAFOutputStream.java b/src/main/java/com/amazon/carbonado/spi/RAFOutputStream.java index 1f2954f..e598f00 100644 --- a/src/main/java/com/amazon/carbonado/spi/RAFOutputStream.java +++ b/src/main/java/com/amazon/carbonado/spi/RAFOutputStream.java @@ -37,18 +37,22 @@ public class RAFOutputStream extends OutputStream { mRAF = raf; } + @Override public void write(int b) throws IOException { mRAF.write(b); } + @Override public void write(byte[] b) throws IOException { mRAF.write(b); } + @Override public void write(byte[] b, int offset, int length) throws IOException { mRAF.write(b, offset, length); } + @Override public void close() throws IOException { mRAF.close(); } diff --git a/src/main/java/com/amazon/carbonado/spi/RepairExecutor.java b/src/main/java/com/amazon/carbonado/spi/RepairExecutor.java index 0bc45ab..fc8a252 100644 --- a/src/main/java/com/amazon/carbonado/spi/RepairExecutor.java +++ b/src/main/java/com/amazon/carbonado/spi/RepairExecutor.java @@ -61,6 +61,7 @@ public class RepairExecutor { ("com.amazon.carbonado.spi.RepairExecutor.queueSize", 10000); cExecutor = new ThreadLocal() { + @Override protected RepairExecutor initialValue() { return new RepairExecutor(keepAliveSeconds, queueSize); } @@ -157,6 +158,7 @@ public class RepairExecutor { setName(Thread.currentThread().getName() + " (repository repair)"); } + @Override public void run() { while (true) { try { diff --git a/src/main/java/com/amazon/carbonado/spi/StoragePool.java b/src/main/java/com/amazon/carbonado/spi/StoragePool.java index 98472b0..fb5e7ce 100644 --- a/src/main/java/com/amazon/carbonado/spi/StoragePool.java +++ b/src/main/java/com/amazon/carbonado/spi/StoragePool.java @@ -51,6 +51,7 @@ public abstract class StoragePool return (Storage) super.get(type); } + @Override protected final Storage create(Class type) throws SupportException, RepositoryException { return createStorage(type); } diff --git a/src/main/java/com/amazon/carbonado/spi/StoredSequence.java b/src/main/java/com/amazon/carbonado/spi/StoredSequence.java index 5b1fba2..6257258 100644 --- a/src/main/java/com/amazon/carbonado/spi/StoredSequence.java +++ b/src/main/java/com/amazon/carbonado/spi/StoredSequence.java @@ -30,6 +30,7 @@ import com.amazon.carbonado.Storable; * @author Brian S O'Neill * @deprecated Replaced by {@link com.amazon.carbonado.sequence.StoredSequence} */ +@Deprecated @PrimaryKey("name") @Authoritative @Independent -- cgit v1.2.3