diff options
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo')
40 files changed, 117 insertions, 38 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedCursor.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedCursor.java index 35fc492..79895c4 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedCursor.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedCursor.java @@ -179,6 +179,7 @@ class IndexedCursor<S extends Storable> extends AbstractCursor<S> { throw new NoSuchElementException();
}
+ @Override
public int skipNext(int amount) throws FetchException {
try {
if (mNext == null) {
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java index 6bea049..7c28ee8 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java @@ -79,6 +79,7 @@ class IndexedRepository implements Repository, mAllClustered = allClustered;
mStoragePool = new StoragePool() {
+ @Override
protected <S extends Storable> Storage<S> createStorage(Class<S> type)
throws RepositoryException
{
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepositoryBuilder.java index d37c50d..392505b 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepositoryBuilder.java @@ -190,6 +190,7 @@ public class IndexedRepositoryBuilder extends AbstractRepositoryBuilder { mAllClustered = clustered;
}
+ @Override
public void errorCheck(Collection<String> messages) throws ConfigurationException {
super.errorCheck(messages);
if (null == getWrappedRepository()) {
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java b/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java index c667dde..a3cc790 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java @@ -52,8 +52,6 @@ import com.amazon.carbonado.cursor.MergeSortBuffer; import com.amazon.carbonado.spi.RepairExecutor;
-import com.amazon.carbonado.qe.BoundaryType;
-
import com.amazon.carbonado.util.Throttle;
/**
@@ -181,6 +179,7 @@ class ManagedIndex<S extends Storable> implements IndexEntryAccessor<S> { return new IndexedCursor<S>(indexEntryQuery.fetch(), storage, mGenerator);
}
+ @Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("IndexInfo ");
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/CompositeStatement.java b/src/main/java/com/amazon/carbonado/repo/jdbc/CompositeStatement.java index 48b81e5..a431ed3 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/CompositeStatement.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/CompositeStatement.java @@ -37,6 +37,7 @@ class CompositeStatement<S extends Storable> extends SQLStatement<S> { mStatements = statements.toArray(new SQLStatement[statements.size()]);
}
+ @Override
public int maxLength() {
int max = 0;
for (SQLStatement<S> statement : mStatements) {
@@ -45,6 +46,7 @@ class CompositeStatement<S extends Storable> extends SQLStatement<S> { return max;
}
+ @Override
public void appendTo(StringBuilder b, FilterValues<S> filterValues) {
for (SQLStatement<S> statement : mStatements) {
statement.appendTo(b, filterValues);
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/H2ExceptionTransformer.java b/src/main/java/com/amazon/carbonado/repo/jdbc/H2ExceptionTransformer.java index e367cb0..4fe3733 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/H2ExceptionTransformer.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/H2ExceptionTransformer.java @@ -29,6 +29,7 @@ import java.sql.SQLException; class H2ExceptionTransformer extends JDBCExceptionTransformer {
public static int DUPLICATE_KEY = 23001;
+ @Override
public boolean isUniqueConstraintError(SQLException e) {
return DUPLICATE_KEY == e.getErrorCode();
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCBlob.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCBlob.java index 18d1eb4..cb3b7ae 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCBlob.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCBlob.java @@ -173,6 +173,7 @@ class JDBCBlob extends AbstractBlob implements JDBCLob { mPos = pos;
}
+ @Override
public int read() throws IOException {
if (fillBuffer() <= 0) {
return -1;
@@ -180,6 +181,7 @@ class JDBCBlob extends AbstractBlob implements JDBCLob { return mBuffer[mBufferPos++];
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
int avail = fillBuffer();
if (avail <= 0) {
@@ -193,6 +195,7 @@ class JDBCBlob extends AbstractBlob implements JDBCLob { return len;
}
+ @Override
public long skip(long n) throws IOException {
if (n <= 0) {
return 0;
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCClob.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCClob.java index dc254bb..efbbe61 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCClob.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCClob.java @@ -173,6 +173,7 @@ class JDBCClob extends AbstractClob implements JDBCLob { mPos = pos;
}
+ @Override
public int read() throws IOException {
if (fillBuffer() <= 0) {
return -1;
@@ -180,6 +181,7 @@ class JDBCClob extends AbstractClob implements JDBCLob { return mBuffer.charAt(mBufferPos++);
}
+ @Override
public int read(char[] c, int off, int len) throws IOException {
int avail = fillBuffer();
if (avail <= 0) {
@@ -193,6 +195,7 @@ class JDBCClob extends AbstractClob implements JDBCLob { return len;
}
+ @Override
public long skip(long n) throws IOException {
if (n <= 0) {
return 0;
@@ -221,6 +224,7 @@ class JDBCClob extends AbstractClob implements JDBCLob { return n;
}
+ @Override
public void close() {
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCCursor.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCCursor.java index 985232c..4f31d2c 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCCursor.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCCursor.java @@ -112,6 +112,7 @@ class JDBCCursor<S extends Storable> extends AbstractCursor<S> { }
}
+ @Override
public int skipNext(int amount) throws FetchException {
if (amount <= 0) {
if (amount < 0) {
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java index 75fde77..250b54e 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java @@ -626,6 +626,7 @@ public class JDBCRepository extends AbstractRepository<JDBCTransaction> return mExceptionTransformer;
}
+ @Override
protected void shutdownHook() {
// Close all open connections.
mOpenConnectionsLock.lock();
@@ -657,10 +658,12 @@ public class JDBCRepository extends AbstractRepository<JDBCTransaction> }
}
+ @Override
protected Log getLog() {
return mLog;
}
+ @Override
protected <S extends Storable> Storage<S> createStorage(Class<S> type)
throws RepositoryException
{
@@ -696,16 +699,19 @@ public class JDBCRepository extends AbstractRepository<JDBCTransaction> return new JDBCStorage<S>(this, info, autoVersioning, suppressReload);
}
+ @Override
protected SequenceValueProducer createSequenceValueProducer(String name)
throws RepositoryException
{
return mSupportStrategy.createSequenceValueProducer(name);
}
+ @Override
protected final TransactionManager<JDBCTransaction> transactionManager() {
return mTxnMgr;
}
+ @Override
protected final TransactionScope<JDBCTransaction> localTransactionScope() {
return mTxnMgr.localScope();
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java index 1fbe2dd..0421e28 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java @@ -392,6 +392,7 @@ public class JDBCRepositoryBuilder extends AbstractRepositoryBuilder { mForceStoredSequence = forceStoredSequence;
}
+ @Override
public void errorCheck(Collection<String> messages) throws ConfigurationException {
super.errorCheck(messages);
if (mDataSource == null) {
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 e775cc9..b5d7bd8 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java @@ -24,12 +24,10 @@ import java.lang.reflect.UndeclaredThrowableException; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Date;
import java.util.LinkedHashMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.TreeMap;
import java.math.BigDecimal;
@@ -447,7 +445,7 @@ public class JDBCStorableIntrospector extends StorableIntrospector { for (StorableKey<S> altKey : mainInfo.getAlternateKeys()) {
if (matchesKey(pkProps, altKey)) {
// Okay. Primary key in database matches a Storable
- // alternate key.
+ // alternate key.
foundAnyAltKey = true;
// Also check that declared primary key is a strict subset
@@ -461,7 +459,7 @@ public class JDBCStorableIntrospector extends StorableIntrospector { if (foundAnyAltKey) {
errorMessages.add("Actual primary key matches a declared alternate key, " +
- "but declared primary key must be a strict subset. " +
+ "but declared primary key must be a strict subset. " +
mainInfo.getPrimaryKey().getProperties() +
" is not a subset of " + pkProps);
} else {
@@ -1121,6 +1119,8 @@ public class JDBCStorableIntrospector extends StorableIntrospector { * shorthand to disambiguate the class name.
*/
private static class JProperty<S extends Storable> implements JDBCStorableProperty<S> {
+ private static final long serialVersionUID = -7333912817502875485L;
+
private final StorableProperty<S> mMainProperty;
private final String mColumnName;
private final Integer mDataType;
@@ -1393,6 +1393,7 @@ public class JDBCStorableIntrospector extends StorableIntrospector { return mExternal.clone();
}
+ @Override
public String toString() {
return mMainProperty.toString();
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java index 39d5a5a..d89a291 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java @@ -25,8 +25,6 @@ import java.sql.Connection; import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -111,6 +109,7 @@ class JDBCStorage<S extends Storable> extends StandardQueryFactory<S> (info.getStorableType(), repository.mTriggerFactories);
}
+ @Override
public Class<S> getStorableType() {
return mInfo.getStorableType();
}
@@ -292,6 +291,7 @@ class JDBCStorage<S extends Storable> extends StandardQueryFactory<S> return mInfo;
}
+ @Override
protected StandardQuery<S> createQuery(Filter<S> filter,
FilterValues<S> values,
OrderingList<S> ordering,
@@ -780,6 +780,7 @@ class JDBCStorage<S extends Storable> extends StandardQueryFactory<S> return mOrdering;
}
+ @Override
public boolean printNative(Appendable app, int indentLevel, FilterValues<S> values)
throws IOException
{
@@ -933,18 +934,22 @@ class JDBCStorage<S extends Storable> extends StandardQueryFactory<S> }
}
+ @Override
protected Transaction enterTransaction(IsolationLevel level) {
return getRootRepository().enterTransaction(level);
}
+ @Override
protected QueryFactory<S> queryFactory() {
return JDBCStorage.this;
}
+ @Override
protected QueryExecutorFactory<S> executorFactory() {
return JDBCStorage.this.mExecutorFactory;
}
+ @Override
protected StandardQuery<S> newInstance(FilterValues<S> values, OrderingList<S> ordering,
QueryHints hints)
{
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java index ca63331..c499a6b 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java @@ -45,6 +45,7 @@ class JDBCTransactionManager extends TransactionManager<JDBCTransaction> { mRepositoryRef = new WeakReference<JDBCRepository>(repository);
}
+ @Override
protected IsolationLevel selectIsolationLevel(Transaction parent, IsolationLevel level) {
JDBCRepository repo = mRepositoryRef.get();
if (repo == null) {
@@ -53,11 +54,13 @@ class JDBCTransactionManager extends TransactionManager<JDBCTransaction> { return repo.selectIsolationLevel(parent, level);
}
+ @Override
protected boolean supportsForUpdate() {
JDBCRepository repo = mRepositoryRef.get();
return repo != null && repo.supportsSelectForUpdate();
}
+ @Override
protected JDBCTransaction createTxn(JDBCTransaction parent, IsolationLevel level)
throws SQLException, FetchException
{
@@ -82,6 +85,7 @@ class JDBCTransactionManager extends TransactionManager<JDBCTransaction> { txn.reuse();
}
+ @Override
protected boolean commitTxn(JDBCTransaction txn) throws PersistException {
try {
txn.commit();
@@ -91,6 +95,7 @@ class JDBCTransactionManager extends TransactionManager<JDBCTransaction> { }
}
+ @Override
protected void abortTxn(JDBCTransaction txn) throws PersistException {
try {
Connection con;
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JoinNode.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JoinNode.java index d5a2ba4..1337476 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JoinNode.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JoinNode.java @@ -191,6 +191,7 @@ class JoinNode { mAliasRequired = true;
}
+ @Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("{table=");
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/LiteralStatement.java b/src/main/java/com/amazon/carbonado/repo/jdbc/LiteralStatement.java index ceedd94..f53a6c7 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/LiteralStatement.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/LiteralStatement.java @@ -34,6 +34,7 @@ class LiteralStatement<S extends Storable> extends SQLStatement<S> { mStr = str;
}
+ @Override
public int maxLength() {
return mStr.length();
}
@@ -43,6 +44,7 @@ class LiteralStatement<S extends Storable> extends SQLStatement<S> { return mStr;
}
+ @Override
public void appendTo(StringBuilder b, FilterValues<S> filterValues) {
b.append(mStr);
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/MysqlExceptionTransformer.java b/src/main/java/com/amazon/carbonado/repo/jdbc/MysqlExceptionTransformer.java index 6b86757..3402bda 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/MysqlExceptionTransformer.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/MysqlExceptionTransformer.java @@ -28,6 +28,7 @@ import java.sql.SQLException; class MysqlExceptionTransformer extends JDBCExceptionTransformer {
public static int DUPLICATE_ENTRY = 1062;
+ @Override
public boolean isUniqueConstraintError(SQLException e) {
if (isConstraintError(e)) {
String sqlstate = e.getSQLState();
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/NullablePropertyStatement.java b/src/main/java/com/amazon/carbonado/repo/jdbc/NullablePropertyStatement.java index 4c7e4db..6843c7a 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/NullablePropertyStatement.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/NullablePropertyStatement.java @@ -37,10 +37,12 @@ class NullablePropertyStatement<S extends Storable> extends SQLStatement<S> { mIsNullOp = isNullOp;
}
+ @Override
public int maxLength() {
return mIsNullOp ? 8 : 12; // for " IS NULL" or " IS NOT NULL"
}
+ @Override
public void appendTo(StringBuilder b, FilterValues<S> filterValues) {
if (filterValues != null
&& filterValues.getValue(mFilter) == null
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/OracleExceptionTransformer.java b/src/main/java/com/amazon/carbonado/repo/jdbc/OracleExceptionTransformer.java index 6f3ff4a..cb633c2 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/OracleExceptionTransformer.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/OracleExceptionTransformer.java @@ -30,6 +30,7 @@ class OracleExceptionTransformer extends JDBCExceptionTransformer { public static int INSUFFICIENT_PRIVILEGES = 1031;
+ @Override
public boolean isUniqueConstraintError(SQLException e) {
if (isConstraintError(e)) {
String sqlstate = e.getSQLState();
@@ -40,6 +41,7 @@ class OracleExceptionTransformer extends JDBCExceptionTransformer { return false;
}
+ @Override
public boolean isInsufficientPrivilegesError(SQLException e) {
if (e != null) {
int errorCode = e.getErrorCode();
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/OracleSupportStrategy.java b/src/main/java/com/amazon/carbonado/repo/jdbc/OracleSupportStrategy.java index 4098933..2a0c9be 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/OracleSupportStrategy.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/OracleSupportStrategy.java @@ -35,14 +35,14 @@ import com.amazon.carbonado.PersistException; * @author bcastill
*/
class OracleSupportStrategy extends JDBCSupportStrategy {
-
+
private static final String DEFAULT_SEQUENCE_SELECT_STATEMENT = "SELECT %s.NEXTVAL FROM DUAL";
private static final String TRUNCATE_STATEMENT = "TRUNCATE TABLE %s";
-
+
private static final int LOB_CHUNK_LIMIT = 2000;
- private static final String PLAN_TABLE_NAME = "TEMP_CARBONADO_PLAN_TABLE";
+ //private static final String PLAN_TABLE_NAME = "TEMP_CARBONADO_PLAN_TABLE";
final Method mBLOB_empty_lob;
final Method mBLOB_getBinaryStream;
@@ -63,7 +63,7 @@ class OracleSupportStrategy extends JDBCSupportStrategy { setSequenceSelectStatement(DEFAULT_SEQUENCE_SELECT_STATEMENT);
setTruncateTableStatement(TRUNCATE_STATEMENT);
-
+
// Access all the custom oracle.sql.BLOB methods via reflection.
{
Method blob_empty_lob = null;
@@ -104,7 +104,7 @@ class OracleSupportStrategy extends JDBCSupportStrategy { try {
Class clobClass = Class.forName("oracle.sql.CLOB");
-
+
clob_empty_lob = clobClass.getMethod("empty_lob");
clob_getCharacterStream = clobClass.getMethod("getCharacterStream", long.class);
clob_length = clobClass.getMethod("length");
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/SQLStatement.java b/src/main/java/com/amazon/carbonado/repo/jdbc/SQLStatement.java index 92308f7..4cfd5f5 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/SQLStatement.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/SQLStatement.java @@ -49,6 +49,7 @@ abstract class SQLStatement<S extends Storable> { /**
* Just used for debugging.
*/
+ @Override
public String toString() {
StringBuilder b = new StringBuilder();
appendTo(b, null);
diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingQuery.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingQuery.java index 6d07801..c4c8414 100644 --- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingQuery.java +++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingQuery.java @@ -242,6 +242,7 @@ class LoggingQuery<S extends Storable> implements Query<S> { appendable.append(mQuery.toString());
}
+ @Override
public String toString() {
return mQuery.toString();
}
diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java index 4032313..3c47857 100644 --- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java @@ -27,8 +27,6 @@ import com.amazon.carbonado.Storable; import com.amazon.carbonado.Storage;
import com.amazon.carbonado.SupportException;
import com.amazon.carbonado.Transaction;
-import com.amazon.carbonado.TriggerFactory;
-
import com.amazon.carbonado.capability.Capability;
import com.amazon.carbonado.spi.StoragePool;
@@ -56,6 +54,7 @@ class LoggingRepository implements Repository, LogAccessCapability { mLog = log;
mStoragePool = new StoragePool() {
+ @Override
protected <S extends Storable> Storage<S> createStorage(Class<S> type)
throws RepositoryException
{
diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepositoryBuilder.java index b8c2892..7463a09 100644 --- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepositoryBuilder.java @@ -148,6 +148,7 @@ public class LoggingRepositoryBuilder extends AbstractRepositoryBuilder { return mRepoBuilder;
}
+ @Override
public void errorCheck(Collection<String> messages) throws ConfigurationException {
super.errorCheck(messages);
if (mRepoBuilder == null) {
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<MapTransaction> return ((MapStorage) storageFor(storableType)).getIndexInfo();
}
+ @Override
protected Log getLog() {
return null;
}
+ @Override
protected TransactionManager<MapTransaction> transactionManager() {
return mTxnManager;
}
+ @Override
protected TransactionScope<MapTransaction> localTransactionScope() {
return mTxnManager.localScope();
}
+ @Override
protected <S extends Storable> Storage<S> createStorage(Class<S> type)
throws RepositoryException
{
return new MapStorage<S>(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<MapTransaction> { mLockTimeoutUnit = lockTimeoutUnit;
}
+ @Override
protected IsolationLevel selectIsolationLevel(Transaction parent, IsolationLevel level) {
if (level == null) {
if (parent == null) {
@@ -63,10 +64,12 @@ class MapTransactionManager extends TransactionManager<MapTransaction> { }
}
+ @Override
protected boolean supportsForUpdate() {
return true;
}
+ @Override
protected MapTransaction createTxn(MapTransaction parent, IsolationLevel level)
throws Exception
{
@@ -87,11 +90,13 @@ class MapTransactionManager extends TransactionManager<MapTransaction> { 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<L> { * @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<L> { }
}
+ @Override
public String toString() {
int state = mState;
int readLocks = state & ~LOCK_STATE_MASK;
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/BlobReplicationTrigger.java b/src/main/java/com/amazon/carbonado/repo/replicated/BlobReplicationTrigger.java index 0657d50..f925b20 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/BlobReplicationTrigger.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/BlobReplicationTrigger.java @@ -41,7 +41,6 @@ import com.amazon.carbonado.info.StorableProperty; import com.amazon.carbonado.lob.AbstractBlob;
import com.amazon.carbonado.lob.Blob;
-import com.amazon.carbonado.lob.ByteArrayBlob;
/**
* After loading a replica, replaces all Blobs with ReplicatedBlobs.
@@ -145,14 +144,17 @@ class BlobReplicationTrigger<S extends Storable> extends Trigger<S> { return mReplicaBlob.getLength();
}
+ @Override
public String asString() throws FetchException {
return mReplicaBlob.asString();
}
+ @Override
public String asString(String charsetName) throws FetchException {
return mReplicaBlob.asString(charsetName);
}
+ @Override
public String asString(Charset charset) throws FetchException {
return mReplicaBlob.asString(charset);
}
@@ -281,21 +283,25 @@ class BlobReplicationTrigger<S extends Storable> extends Trigger<S> { mReplicaOut = replica;
}
+ @Override
public void write(int b) throws IOException {
mMasterOut.write(b);
mReplicaOut.write(b);
}
+ @Override
public void write(byte[] b, int off, int len) throws IOException {
mMasterOut.write(b, off, len);
mReplicaOut.write(b, off, len);
}
+ @Override
public void flush() throws IOException {
mMasterOut.flush();
mReplicaOut.flush();
}
+ @Override
public void close() throws IOException {
mMasterOut.close();
mReplicaOut.close();
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ClobReplicationTrigger.java b/src/main/java/com/amazon/carbonado/repo/replicated/ClobReplicationTrigger.java index 5da6eed..3300210 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ClobReplicationTrigger.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ClobReplicationTrigger.java @@ -39,7 +39,6 @@ import com.amazon.carbonado.info.StorableProperty; import com.amazon.carbonado.lob.AbstractClob;
import com.amazon.carbonado.lob.Clob;
-import com.amazon.carbonado.lob.CharArrayClob;
/**
* After loading a replica, replaces all Clobs with ReplicatedClobs.
@@ -143,6 +142,7 @@ class ClobReplicationTrigger<S extends Storable> extends Trigger<S> { return mReplicaClob.getLength();
}
+ @Override
public String asString() throws FetchException {
return mReplicaClob.asString();
}
@@ -271,21 +271,25 @@ class ClobReplicationTrigger<S extends Storable> extends Trigger<S> { mReplicaOut = replica;
}
+ @Override
public void write(int c) throws IOException {
mMasterOut.write(c);
mReplicaOut.write(c);
}
+ @Override
public void write(char[] c, int off, int len) throws IOException {
mMasterOut.write(c, off, len);
mReplicaOut.write(c, off, len);
}
+ @Override
public void flush() throws IOException {
mMasterOut.flush();
mReplicaOut.flush();
}
+ @Override
public void close() throws IOException {
mMasterOut.close();
mReplicaOut.close();
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java index f43e043..55a1710 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java @@ -152,6 +152,7 @@ class ReplicatedRepository mMasterRepository = aMasterRepository;
mStoragePool = new StoragePool() {
+ @Override
protected <S extends Storable> Storage<S> createStorage(Class<S> type)
throws SupportException, RepositoryException
{
@@ -448,10 +449,9 @@ class ReplicatedRepository masterCursor = masterQuery.fetch();
S lastReplicaEntry = null;
- S lastMasterEntry = null;
S replicaEntry = null;
S masterEntry = null;
-
+
int count = 0, txnCount = 0;
while (true) {
if (throttle != null) {
@@ -531,7 +531,7 @@ class ReplicatedRepository }
}
}
-
+
if (count++ >= RESYNC_WATERMARK || txnCount >= RESYNC_BATCH_SIZE) {
replicaTxn.commit();
if (replicaCursor != null) {
@@ -567,7 +567,6 @@ class ReplicatedRepository // Replica cursor is missing an entry so copy it.
resyncTask = prepareResyncTask(replicationTrigger, null, masterEntry);
// Allow master to advance.
- lastMasterEntry = masterEntry;
masterEntry = null;
} else {
// If compare is zero, replicaEntry and masterEntry are
@@ -590,7 +589,6 @@ class ReplicatedRepository replicaCursor = replicaQuery.fetchAfter(replicaEntry);
}
lastReplicaEntry = replicaEntry;
- lastMasterEntry = masterEntry;
replicaEntry = null;
masterEntry = null;
}
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java index 3ab2146..cf19600 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java @@ -85,6 +85,7 @@ public class ReplicatedRepositoryBuilder extends AbstractRepositoryBuilder { BelatedRepositoryCreator creator = new BelatedRepositoryCreator
(log, mMasterRepositoryBuilder, rootRef, DEFAULT_RETRY_MILLIS) {
+ @Override
protected void createdNotification(Repository repo) {
// Don't need builder any more so restore it.
mMasterRepositoryBuilder.setMaster(originalOption);
@@ -155,6 +156,7 @@ public class ReplicatedRepositoryBuilder extends AbstractRepositoryBuilder { mMasterRepositoryBuilder = masterRepositoryBuilder;
}
+ @Override
public void errorCheck(Collection<String> messages) throws ConfigurationException {
super.errorCheck(messages);
if (null == getReplicaRepositoryBuilder()) {
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java index 996a9f8..3ab69c0 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java @@ -22,7 +22,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
import com.amazon.carbonado.FetchException;
-import com.amazon.carbonado.FetchNoneException;
import com.amazon.carbonado.OptimisticLockException;
import com.amazon.carbonado.PersistException;
import com.amazon.carbonado.PersistNoneException;
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<Txn, S extends Storable> extends RawCursor<S> { }
}
+ @Override
public void close() throws FetchException {
try {
super.close();
@@ -84,6 +85,7 @@ abstract class BDBCursor<Txn, S extends Storable> extends RawCursor<S> { }
}
+ @Override
protected void release() throws FetchException {
try {
cursor_close();
@@ -92,6 +94,7 @@ abstract class BDBCursor<Txn, S extends Storable> extends RawCursor<S> { }
}
+ @Override
protected byte[] getCurrentKey() throws FetchException {
if (searchKey_getPartial()) {
throw new IllegalStateException();
@@ -99,6 +102,7 @@ abstract class BDBCursor<Txn, S extends Storable> extends RawCursor<S> { return searchKey_getDataCopy();
}
+ @Override
protected byte[] getCurrentValue() throws FetchException {
if (data_getPartial()) {
throw new IllegalStateException();
@@ -106,15 +110,18 @@ abstract class BDBCursor<Txn, S extends Storable> extends RawCursor<S> { 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<Txn, S extends Storable> extends RawCursor<S> { }
}
+ @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<Txn, S extends Storable> extends RawCursor<S> { }
}
+ @Override
protected boolean toFirst(byte[] key) throws FetchException {
try {
searchKey_setData(key);
@@ -152,6 +162,7 @@ abstract class BDBCursor<Txn, S extends Storable> extends RawCursor<S> { }
}
+ @Override
protected boolean toLast() throws FetchException {
try {
return cursor_getLast();
@@ -160,6 +171,7 @@ abstract class BDBCursor<Txn, S extends Storable> extends RawCursor<S> { }
}
+ @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<Txn, S extends Storable> extends RawCursor<S> { }
}
+ @Override
protected boolean toNext() throws FetchException {
try {
return cursor_getNext();
@@ -217,6 +230,7 @@ abstract class BDBCursor<Txn, S extends Storable> extends RawCursor<S> { }
}
+ @Override
protected boolean toPrevious() throws FetchException {
try {
return cursor_getPrev();
@@ -254,6 +268,7 @@ abstract class BDBCursor<Txn, S extends Storable> extends RawCursor<S> { 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<Txn> extends AbstractRepository<Txn> mFileNameMap = builder.getFileNameMap();
}
+ @Override
@SuppressWarnings("unchecked")
public <C extends Capability> C getCapability(Class<C> capabilityType) {
C cap = super.getCapability(capabilityType);
@@ -279,6 +280,7 @@ abstract class BDBRepository<Txn> extends AbstractRepository<Txn> 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<Txn> extends AbstractRepository<Txn> }
}
+ @Override
protected Log getLog() {
return mLog;
}
+ @Override
protected <S extends Storable> Storage createStorage(Class<S> type)
throws RepositoryException
{
@@ -341,6 +345,7 @@ abstract class BDBRepository<Txn> extends AbstractRepository<Txn> }
}
+ @Override
protected SequenceValueProducer createSequenceValueProducer(String name)
throws RepositoryException
{
@@ -528,10 +533,12 @@ abstract class BDBRepository<Txn> extends AbstractRepository<Txn> return mExTransformer.toRepositoryException(e);
}
+ @Override
protected final TransactionManager<Txn> transactionManager() {
return mTxnMgr;
}
+ @Override
protected final TransactionScope<Txn> localTransactionScope() {
return mTxnMgr.localScope();
}
@@ -575,6 +582,7 @@ abstract class BDBRepository<Txn> extends AbstractRepository<Txn> mMinutes = minutes;
}
+ @Override
public void run() {
try {
while (true) {
@@ -711,6 +719,7 @@ abstract class BDBRepository<Txn> extends AbstractRepository<Txn> 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<String> 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<Txn> extends TransactionManager<Txn> { mRepositoryRef = new WeakReference<BDBRepository<Txn>>(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<Txn> extends TransactionManager<Txn> { }
}
+ @Override
protected boolean commitTxn(Txn txn) throws PersistException {
try {
repository().txn_commit(txn);
@@ -83,6 +87,7 @@ class BDBTransactionManager<Txn> extends TransactionManager<Txn> { }
}
+ @Override
protected void abortTxn(Txn txn) throws PersistException {
try {
repository().txn_abort(txn);
|