* If this ColumnTracker track {@link HaeinsaScan}, minColumn, maxColumn
- * should be null and minColumnInclusive, maxColumnInclusive should be
- * false.
- *
- * @param familyMap
- *
- * @param minColumn
- * @param minColumnInclusive
- * @param maxColumn
- * @param maxColumnInclusive
+ * should be null and minColumnInclusive, maxColumnInclusive should be false.
*/
public HaeinsaColumnTracker(Map
* Using lexicographical ordering to compare byte[]
- *
- * @param kv
- * @return
*/
public boolean isColumnInclusive(HaeinsaKeyValue kv) {
int cmpMin = 1;
@@ -121,7 +110,6 @@ public boolean isColumnInclusive(HaeinsaKeyValue kv) {
*
*
* @param kv HaeinsaKeyValue which will be checked.
- * @return
*/
public boolean isMatched(HaeinsaKeyValue kv) {
// If familyMap is empty, then Haeinsa transaction assumes
diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaConstants.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaConstants.java
index fb1a32f..13808fa 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaConstants.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaConstants.java
@@ -26,8 +26,7 @@
* Static Class of Constants for Haeinsa
*/
public final class HaeinsaConstants {
- private HaeinsaConstants() {
- }
+ private HaeinsaConstants() {}
/**
* Haeinsa protocol version of this release.
diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java
index 499af6f..fe109b8 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java
@@ -32,7 +32,7 @@
import com.google.common.collect.Sets;
/**
- * Implementation of {@link HaeinsaMuation} which only contains HaeinsaKeyValue
+ * Implementation of {@link HaeinsaMutation} which only contains HaeinsaKeyValue
* with {@link Type#DeleteFamily} and {@link Type#DeleteColumn} identifier.
* HaeinsaPut can be analogous to {@link Delete} class in HBase.
*
@@ -121,9 +121,10 @@ public TMutation toTMutation() {
newTRemove.addToRemoveFamilies(ByteBuffer.wrap(kv.getFamily()));
break;
}
- default:
+ default: {
break;
}
+ }
}
newTMutation.setRemove(newTRemove);
return newTMutation;
diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java
index 9fcd490..9139e2d 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java
@@ -31,11 +31,10 @@ public class HaeinsaDeleteTracker {
private final NavigableMap
@@ -30,8 +32,7 @@
*/
public class HaeinsaGet extends HaeinsaQuery {
private byte[] row;
- private Map
* HaeinsaKeyValue has public static comparator which can be used in
- * navigableMap. This comparator is ComparisionChain of {@link NullableCompator}
+ * navigableMap. This comparator is ComparisionChain of {@link NullableComparator}
* wrapped {@link org.apache.hadoop.hbase.util.Bytes#BYTES_COMPARATOR}. The
* order of comparisonChain is row, family, qualifier, value and type.
*/
@@ -45,9 +45,9 @@ public class HaeinsaKeyValue {
@Override
public int compare(HaeinsaKeyValue o1, HaeinsaKeyValue o2) {
return ComparisonChain.start()
- .compare(o1.getRow(), o2.getRow(), new NullableComparator
- * HaeinsaMutation provides {@link HaeinsaKeyValueScanner} interface by {@link #getScanner()} method.
+ * HaeinsaMutation provides {@link HaeinsaKeyValueScanner} interface by {@link #getScanner(long)} method.
*/
public abstract class HaeinsaMutation extends HaeinsaOperation {
protected byte[] row;
// { family -> HaeinsaKeyValue }
- protected Map
@@ -54,7 +54,7 @@ public HaeinsaPut(byte[] row) {
*/
public HaeinsaPut(HaeinsaPut putToCopy) {
this(putToCopy.getRow());
- this.familyMap = new TreeMap
* Return {@link SimpleClientScanner} which do not support transaction if tx is null.
* User can use this feature if specific scan operation does not require strong consistency
@@ -272,8 +268,6 @@ public HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, HaeinsaS
* {@link HaeinsaTransaction#commit()} to check or mutate lock column of the row scanned by this method.
* This method can be used when read performance is important or strict consistency of the result is not matter.
*
- * @param scan
- * @return
* @throws IOException IOException from HBase.
*/
private HaeinsaResultScanner getScannerWithoutTx(HaeinsaScan scan) throws IOException {
@@ -297,7 +291,7 @@ private HaeinsaResultScanner getScannerWithoutTx(HaeinsaScan scan) throws IOExce
/**
* Haeinsa implementation of {@link ColumnRangeFilter}.
* Scan range of column inside single row defined by {@link HaeinsaIntraScan} in the context of transaction(tx).
- * Return {@link #ClientScanner} which related to {@link HaeinsaTable} and {@link HaeinsaTransaction}.
+ * Return {@link ClientScanner} which related to {@link HaeinsaTable} and {@link HaeinsaTransaction}.
*
* Return {@link SimpleClientScanner} which do not support transaction if tx is null.
* User can use this feature if specific intra-scan operation does not require strong consistency.
@@ -313,7 +307,7 @@ public HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, HaeinsaI
}
// scan from startRow ( inclusive ) to startRow + 0x00 ( exclusive )
- Scan hScan = new Scan(intraScan.getRow(), Bytes.add(intraScan.getRow(), new byte[] { 0x00 }));
+ Scan hScan = new Scan(intraScan.getRow(), Bytes.add(intraScan.getRow(), new byte[]{0x00}));
hScan.setBatch(intraScan.getBatch());
hScan.setCacheBlocks(intraScan.getCacheBlocks());
@@ -348,12 +342,10 @@ public HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, HaeinsaI
* {@link HaeinsaTransaction#commit()} to check or mutate lock column of the row scanned by this method.
* This method can be used when read performance is important or strict consistency of the result is not matter.
*
- * @param intraScan
- * @return
* @throws IOException IOException from HBase.
*/
private HaeinsaResultScanner getScannerWithoutTx(HaeinsaIntraScan intraScan) throws IOException {
- Scan hScan = new Scan(intraScan.getRow(), Bytes.add(intraScan.getRow(), new byte[] { 0x00 }));
+ Scan hScan = new Scan(intraScan.getRow(), Bytes.add(intraScan.getRow(), new byte[]{0x00}));
hScan.setBatch(intraScan.getBatch());
for (byte[] family : intraScan.getFamilies()) {
@@ -388,21 +380,16 @@ public void put(HaeinsaTransaction tx, HaeinsaPut put) throws IOException {
* Check rowState and whether it contains {@link TRowLock} already, create one if not.
*
* Get {@link TRowLock} of the row from HBase if rowState does not contains it.
- * If lock is not in stable state, try to recover it first by {@link HaeinsaTrasaction#recover()}.
+ * If lock is not in stable state, try to recover it first by {@link HaeinsaTransaction#recover(boolean)}.
*
- * By calling this method proper time, {@link RowTransaction} inside {@link HaeinsaTransaction} can have
+ * By calling this method proper time, {@link HaeinsaRowTransaction} inside {@link HaeinsaTransaction} can have
* {@link TRowLock} of the row when this method was called first time in the context of the transaction.
*
- * @param tx
- * @param row
- * @param tableState
- * @param rowState
- * @return
* @throws IOException ConflictException, HBase IOException
*/
private HaeinsaRowTransaction checkOrRecoverLock(HaeinsaTransaction tx,
- byte[] row, HaeinsaTableTransaction tableState,
- @Nullable HaeinsaRowTransaction rowState) throws IOException {
+ byte[] row, HaeinsaTableTransaction tableState,
+ @Nullable HaeinsaRowTransaction rowState) throws IOException {
if (rowState != null && rowState.getCurrent() != null) {
// return rowState itself if rowState already exist and contains TRowLock
return rowState;
@@ -438,11 +425,10 @@ private HaeinsaRowTransaction checkOrRecoverLock(HaeinsaTransaction tx,
* Return false if rowLock is in {@link TRowLockState#STABLE} state.
* Throw {@link ConflictException} if rowLock is not in stable state and not expired yet.
*
- * @param rowLock
* @return true - when lock is established but expired. / false - when there
- * is no lock ( {@link TRowLockState#STABLE} )
+ * is no lock ( {@link TRowLockState#STABLE} )
* @throws IOException {@link NotExpiredYetException} if lock is established and
- * not expired.
+ * not expired.
*/
private boolean checkAndIsShouldRecover(TRowLock rowLock) throws IOException {
if (rowLock.getState() != TRowLockState.STABLE) {
@@ -455,12 +441,10 @@ private boolean checkAndIsShouldRecover(TRowLock rowLock) throws IOException {
}
/**
- * Call {@link HaeinsaTransaction#recover()}.
+ * Call {@link HaeinsaTransaction#recover(boolean)}.
* Abort or recover when there is failed transaction on the row,
* throw {@link ConflictException} when there is ongoing transaction.
*
- * @param tx
- * @param row
* @throws IOException ConflictException, HBase IOException
*/
private void recover(HaeinsaTransaction tx, byte[] row) throws IOException {
@@ -541,11 +525,8 @@ public void commitSingleRowPutOnly(HaeinsaRowTransaction rowState, byte[] row) t
* If TRowLock is changed, it means transaction is failed, so throw
* {@link ConflictException}.
*
- * @param prevRowLock
- * @param row
* @throws IOException ConflictException, HBase IOException.
- * @throws NullPointException if oldLock is null (haven't read lock from
- * HBase)
+ * @throws NullPointerException if oldLock is null (haven't read lock from HBase)
*/
@Override
public void checkSingleRowLock(HaeinsaRowTransaction rowState, byte[] row) throws IOException {
@@ -680,9 +661,10 @@ public void applyMutations(HaeinsaRowTransaction rowTxState, byte[] row) throws
}
break;
}
- default:
+ default: {
break;
}
+ }
}
}
@@ -798,7 +780,7 @@ protected HTableInterface getHTable() {
}
/**
- * Implementation of {@link HaeinsaReulstScanner} which is used when scan without transaction.
+ * Implementation of {@link HaeinsaResultScanner} which is used when scan without transaction.
*/
private class SimpleClientScanner implements HaeinsaResultScanner {
private final ResultScanner scanner;
@@ -879,29 +861,21 @@ private class ClientScanner implements HaeinsaResultScanner {
private long maxSeqID = Long.MAX_VALUE;
/**
- *
- * @param tx
- * @param scanners
- * @param familyMap
* @param lockInclusive - whether scanners contains {@link TRowLock} inside.
- * If not, should bring from {@link RowTransaction} or get from HBase directly.
+ * If not, should bring from {@link HaeinsaRowTransaction} or get from HBase directly.
*/
public ClientScanner(HaeinsaTransaction tx, Iterable
* The reason why there are different variables for {@link #scannerList} and {@link #scanners} is that
- * the way {@link #nextScanner()} implemented is removing {@link HaeinsaKeyValueScanner} one by one form scanners.
+ * the way {@link #nextScanner(HaeinsaKeyValueScanner)} implemented is removing
+ * {@link HaeinsaKeyValueScanner} one by one form scanners.
* {@link #close()} method needs to close every {@link ClientScanner} when called,
* so some other variable should preserve every scanner when ClientScanner created.
- *
- * @throws IOException
*/
private void initialize() throws IOException {
try {
@@ -990,7 +963,7 @@ public boolean hasNext() {
}
/**
- * Return {@link TRowLock} for specific row from {@link IOException#scanners}.
+ * Return {@link TRowLock} for specific row from {@link #scanners}.
* Return null if there is no proper {@link TRowLock}.
*
* If one of these {@link #scanners} has row key which is smaller than given row,
@@ -998,10 +971,8 @@ public boolean hasNext() {
* So proper operation is guaranteed only when every scanner in {@link #scanners} return
* smaller or equal row key when {@link HaeinsaKeyValueScanner#peek()} is called.
*
- * @param row
* @return null if there is no TRowLock information inside scanners,
- * return rowLock otherwise.
- * @throws IOException
+ * return rowLock otherwise.
*/
private TRowLock peekLock(byte[] row) throws IOException {
for (HaeinsaKeyValueScanner scanner : scanners) {
@@ -1101,8 +1072,8 @@ public HaeinsaResult next() throws IOException {
deleteTracker.add(currentKV, currentScanner.getSequenceID());
} else if (prevKV == currentKV
|| !(Bytes.equals(prevKV.getRow(), currentKV.getRow())
- && Bytes.equals(prevKV.getFamily(), currentKV.getFamily())
- && Bytes.equals(prevKV.getQualifier(), currentKV.getQualifier()))) {
+ && Bytes.equals(prevKV.getFamily(), currentKV.getFamily())
+ && Bytes.equals(prevKV.getQualifier(), currentKV.getQualifier()))) {
// if reference of prevKV and currentKV is same, the currentKV have new row.
// Ignore when prevKV and currentKV is different but row, family,
// qualifier of currentKv and prevKv is all same. (not likely)
@@ -1143,9 +1114,6 @@ public HaeinsaResult next() throws IOException {
* Moving index of scanner of currentScanner by one. If there is no more
* element at the scanner, remove currentScanner from scanners
* (NavigableSet)
- *
- * @param currentScanner
- * @throws IOException
*/
private void nextScanner(HaeinsaKeyValueScanner currentScanner) throws IOException {
scanners.remove(currentScanner);
@@ -1301,8 +1269,8 @@ public void close() {
* So {@link #peek()} method or {@link #next()} method will return value from same row.
*
* HBaseGetScanner is now used in two cases.
- * First, inside {@link HaeinsaTable#get()}, {@link HaeinsaKeyValue}s returned by this class will
- * always have sequenceId of Long.MAX_VALUE.
+ * First, inside {@link HaeinsaTable#get(HaeinsaTransaction, HaeinsaGet)}, {@link HaeinsaKeyValue}s
+ * returned by this class will always have sequenceId of Long.MAX_VALUE.
* Second is used inside {@link ClientScanner}. In this case, HBaseGetScanner recover failed transaction and
* get recovered data from HBase.
* Recovered {@link HaeinsaKeyValue} should have smaller sequenceId contained in ClientScanner so far
@@ -1366,7 +1334,6 @@ public long getSequenceID() {
}
@Override
- public void close() {
- }
+ public void close() {}
}
}
diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIface.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIface.java
index 81071d3..5f327c5 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIface.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIface.java
@@ -61,12 +61,12 @@ public interface HaeinsaTableIface extends Closeable {
* Extracts certain cells from a given row.
*
* @param tx HaeinsaTransaction which this operation is participated in.
- * It can be null if user don't want to execute get inside transaction.
+ * It can be null if user don't want to execute get inside transaction.
* @param get The object that specifies what data to fetch and from which row.
* @return The data coming from the specified row, if it exists. If the row
- * specified doesn't exist, the {@link HaeinsaResult} instance returned
- * won't contain any {@link HaeinsaKeyValue}, as indicated by
- * {@link HaeinsaResult#isEmpty()}.
+ * specified doesn't exist, the {@link HaeinsaResult} instance returned
+ * won't contain any {@link HaeinsaKeyValue}, as indicated by
+ * {@link HaeinsaResult#isEmpty()}.
* @throws IOException if a remote or network exception occurs.
*/
HaeinsaResult get(@Nullable HaeinsaTransaction tx, HaeinsaGet get) throws IOException;
@@ -76,7 +76,7 @@ public interface HaeinsaTableIface extends Closeable {
* Similar with {@link HaeinsaTableIface#getScanner(HaeinsaTransaction, HaeinsaScan)}.
*
* @param tx HaeinsaTransaction which this operation is participated in.
- * It can be null if user don't want to execute scan inside transaction.
+ * It can be null if user don't want to execute scan inside transaction.
* @param family The column family to scan.
* @return A scanner.
* @throws IOException if a remote or network exception occurs.
@@ -88,7 +88,7 @@ public interface HaeinsaTableIface extends Closeable {
* Similar with {@link HaeinsaTableIface#getScanner(HaeinsaTransaction, HaeinsaScan)}.
*
* @param tx HaeinsaTransaction which this operation is participated in.
- * It can be null if user don't want to execute scan inside transaction.
+ * It can be null if user don't want to execute scan inside transaction.
* @param family The column family to scan.
* @param qualifier The column qualifier to scan.
* @return A scanner.
@@ -102,7 +102,7 @@ HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, byte[] family,
* object.
*
* @param tx HaeinsaTransaction which this operation is participated in.
- It can be null if user don't want to execute scan inside transaction.
+ * It can be null if user don't want to execute scan inside transaction.
* @param scan A configured {@link HaeinsaScan} object.
* @return A scanner.
* @throws IOException if a remote or network exception occurs.
@@ -114,7 +114,7 @@ HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, byte[] family,
* object.
*
* @param tx HaeinsaTransaction which this operation is participated in.
- * It can be null if user don't want to execute scan inside transaction.
+ * It can be null if user don't want to execute scan inside transaction.
* @param intraScan A configured {@link HaeinsaIntraScan} object.
* @return A scanner.
* @throws IOException if a remote or network exception occurs.
@@ -168,5 +168,4 @@ HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, byte[] family,
*/
@Override
void close() throws IOException;
-
}
diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceFactory.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceFactory.java
index b57a071..8936e4b 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceFactory.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceFactory.java
@@ -35,8 +35,6 @@ public interface HaeinsaTableIfaceFactory {
/**
* Release the HaeinsaTable resource represented by the table.
- * @param table
*/
void releaseHaeinsaTableIface(final HaeinsaTableIface table) throws IOException;
-
}
diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java
index 7330498..ae9aa4d 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java
@@ -40,8 +40,6 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface {
* If TRowLock is changed and checkAndPut failed, it means transaction is
* failed so throw {@link ConflictException}.
*
- * @param rowState
- * @param row
* @throws IOException ConflictException, HBase IOException.
*/
void commitSingleRowPutOnly(HaeinsaRowTransaction rowState, byte[] row) throws IOException;
@@ -51,11 +49,8 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface {
* If TRowLock is changed, it means transaction is failed, so throw
* {@link ConflictException}.
*
- * @param prevRowLock
- * @param row
* @throws IOException ConflictException, HBase IOException.
- * @throws NullPointException if oldLock is null (haven't read lock from
- * HBase)
+ * @throws NullPointerException if oldLock is null (haven't read lock from HBase)
*/
void checkSingleRowLock(HaeinsaRowTransaction rowState, byte[] row) throws IOException;
@@ -65,16 +60,13 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface {
* If first mutation in rowState is {@link HaeinsaPut}, then apply consequent Puts in the same RPC which changes lock to
* {@link TRowLockState#PREWRITTEN}.
* Remaining mutations which is not applied with first RPC is remained in {@link TRowLock#mutations}.
- * This field will be used in {@link #applyMutations()} stage.
+ * This field will be used in {@link #applyMutations(HaeinsaRowTransaction, byte[])} stage.
* Columns written in prewritten stage will be recorded in {@link TRowLock#prewritten} field,
* which will be used in {@link HaeinsaTransaction#recover(boolean)} to clean up dirty data
* if transaction failed.
*
* Add list of secondary rows in secondaries field if this row is primary row, add key of primary row in primary field otherwise.
*
- * @param rowState
- * @param row
- * @param isPrimary
* @throws IOException ConflictException, HBase IOException
*/
void prewrite(HaeinsaRowTransaction rowState, byte[] row, boolean isPrimary) throws IOException;
@@ -93,8 +85,6 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface {
* However this is not an issue for transaction consistency because new client will execute idempotent remove operations one more time
* on same timestamp which are already used during previous transaction attempt.
*
- * @param rowTxState
- * @param row
* @throws IOException ConflictException, HBase IOException.
*/
void applyMutations(HaeinsaRowTransaction rowTxState, byte[] row) throws IOException;
@@ -104,8 +94,6 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface {
* Use commitTimestamp field of {@link TRowLock} as timestamp on HBase.
* Only {@link TRowLock#version}, {@link TRowLock#state} and {@link TRowLock#commitTimestamp} fields are written.
*
- * @param tx
- * @param row
* @throws IOException ConflictException, HBase IOException.
*/
void makeStable(HaeinsaRowTransaction rowTxState, byte[] row) throws IOException;
@@ -118,8 +106,6 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface {
* failed-over client will call this method again to extend lock expiry on primary row.
* In this case, {@link TRowLock} is remained in {@link TRowLockState#COMMITTED}.
*
- * @param tx
- * @param row
* @throws IOException ConflictException, HBase IOException.
*/
void commitPrimary(HaeinsaRowTransaction rowTxState, byte[] row) throws IOException;
@@ -141,23 +127,19 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface {
* or {@link TRowLockState#ABORTED} to another {@link TRowLockState#ABORTED}.
* Later is when different client failed again during cleaning up aborted transaction.
*
- * @param tx
- * @param row
* @throws IOException ConflictException, HBase IOException.
*/
void abortPrimary(HaeinsaRowTransaction rowTxState, byte[] row) throws IOException;
/**
* Delete columns that are prewritten to the specific row during prewritten stage.
+ *
* Haeinsa can infer prewritten columns to clean up by parsing prewritten field in {@link TRowLock}.
* Should remove column which have {@link TRowLock#currentTimestamp} as timestamp.
- * This is possible by using {@link Delete#deleteColumn()} instead of {@link Delete#deleteColumns()}.
*
- * Because Haeinsa uses {@link HTableInterface#checkAndDelete()} to delete prewrittens,
+ * Because Haeinsa uses {@link HTableInterface#checkAndDelete(byte[], byte[], byte[], byte[], Delete)} to delete prewrittens,
* {@link TRowLock} is not changed. It will throw {@link ConflictException} if failed to acquire lock in checkAndDelete.
*
- * @param rowTxState
- * @param row
* @throws IOException ConflictException, HBase IOException.
*/
void deletePrewritten(HaeinsaRowTransaction rowTxState, byte[] row) throws IOException;
diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java
index 64d7d11..0a5ec35 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java
@@ -79,7 +79,7 @@ public HaeinsaTablePool(final Configuration config, final int maxSize, final Hae
* @param config configuration
* @param maxSize maximum number of references to keep for each table
* @param poolType pool type which is one of {@link PoolType#Reusable} or
- * {@link PoolType#ThreadLocal}
+ * {@link PoolType#ThreadLocal}
*/
public HaeinsaTablePool(final Configuration config, final int maxSize, final PoolType poolType) {
this(config, maxSize, null, poolType);
@@ -96,10 +96,10 @@ public HaeinsaTablePool(final Configuration config, final int maxSize, final Poo
* @param maxSize maximum number of references to keep for each table
* @param tableFactory table factory
* @param poolType pool type which is one of {@link PoolType#Reusable} or
- * {@link PoolType#ThreadLocal}
+ * {@link PoolType#ThreadLocal}
*/
public HaeinsaTablePool(final Configuration config, final int maxSize,
- final HaeinsaTableIfaceFactory tableFactory, PoolType poolType) {
+ final HaeinsaTableIfaceFactory tableFactory, PoolType poolType) {
// Make a new configuration instance so I can safely cleanup when
// done with the pool.
this.config = config == null ? new Configuration() : config;
@@ -110,13 +110,15 @@ public HaeinsaTablePool(final Configuration config, final int maxSize,
} else {
switch (poolType) {
case Reusable:
- case ThreadLocal:
+ case ThreadLocal: {
this.poolType = poolType;
break;
- default:
+ }
+ default: {
this.poolType = PoolType.Reusable;
break;
}
+ }
}
this.tables = new PoolMap
* Note: this is a 'shutdown' of the given table pool and different from
- * {@link #putTable(HaeinsaTableIface)}, that is used to return the table
+ * {@link #release(HaeinsaTableIface)}, that is used to return the table
* instance to the pool for future re-use.
- *
- * @param tableName
*/
public void closeTablePool(final String tableName) throws IOException {
Collection
* HaeinsaTransaction can be generated via calling {@link HaeinsaTransactionManager#begin()}
- * or {@link HaeinsaTransactionManager#getTransaction()}.
+ * or {@link HaeinsaTransactionManager#getTransaction(byte[], byte[])}.
* Former is used when start new transaction, later is used when try to roll back or retry failed transaction.
*
* One {@link HaeinsaTransaction} can't be used after calling {@link #commit()} or {@link #rollback()} is called.
@@ -166,9 +166,8 @@ HaeinsaTransactionLocals getLocals() {
/**
* Bring {@link HaeinsaTableTransaction} which have name of tableName.
* If there is no {@link HaeinsaTableTransaction} have this name,
- * then create one instance for it and save inside {@link #tableStates} and return.
+ * then create one instance for it and save inside {@link #txStates} and return.
*
- * @param tableName
* @return instance of {@link HaeinsaTableTransaction}
*/
protected HaeinsaTableTransaction createOrGetTableState(byte[] tableName) {
@@ -266,13 +265,14 @@ public void commit() throws IOException {
case NOTHING: {
break;
}
- default:
+ default: {
break;
}
+ }
}
/**
- * Use {@link HaeinsaTable#checkSingleRowLock()} to check RowLock on HBase
+ * Use {@link HaeinsaTable#checkSingleRowLock(HaeinsaRowTransaction, byte[])} to check RowLock on HBase
* of read-only rows of tx. If all lock-checking by get was success,
* read-only tx was success. Throws ConflictException otherwise.
*
@@ -309,8 +309,6 @@ private void commitReadOnly() throws IOException {
/**
* Commit single row & PUT only (possibly include get/scan, but not Delete)
* Transaction.
- *
- * @throws IOException
*/
private void commitSingleRowPutOnly() throws IOException {
HaeinsaTableTransaction primaryTableState = createOrGetTableState(primary.getTableName());
@@ -373,7 +371,7 @@ private void commitMultiRowsMutation() throws IOException {
* 1. In case of {@link #commitMultiRowsMutation()}, after changing primary row to
* {@link TRowLockState#COMMITTED} and applying all mutations in primary row and secondary rows.
*
- * 2. When try to {@link #recover()} failed transaction in the middle of execution.
+ * 2. When try to {@link #recover(boolean)} failed transaction in the middle of execution.
* This method should be called only when primary row is in the state of {@link TRowLockState#COMMITTED}.
*
* @throws IOException ConflictException, HBase IOException.
@@ -419,12 +417,11 @@ private void makeStable() throws IOException {
}
/**
- * Reload information of failed transaction and complete it by calling {@link #makStable()}
+ * Reload information of failed transaction and complete it by calling {@link #makeStable()}
* if already completed one, ( when primaryRow have {@link TRowLockState#COMMITTED} state }
* or abort by calling {@link #abort()} otherwise.
*
* @param ignoreExpiry ignore row lock's expiry
- * @throws IOException
*/
protected void recover(boolean ignoreExpiry) throws IOException {
boolean onRecovery = true;
@@ -470,7 +467,7 @@ protected void recover(boolean ignoreExpiry) throws IOException {
*
* Aborting is executed by following order.
*
* Transaction of single row with at least one of {@link HaeinsaDelete}
* will be considered as {@link CommitMethod#MULTI_ROW_MUTATIONS}.
- *
- * @return
*/
public CommitMethod determineCommitMethod() {
int count = 0;
@@ -606,8 +602,6 @@ public CommitMethod determineCommitMethod() {
/**
* Return mutation rows which is hash-sorted by TRowKey(table, row).
- *
- * @return
*/
public NavigableMap
- * As similar to {@link #getTransactionFromPrimary()}, rowTransaction added by this method do not have
+ * As similar to {@link #getTransactionFromPrimary(TRowKey, TRowLock)}, rowTransaction added by this method do not have
* proper mutations variable.
- *
- * @param transaction
- * @param rowKey
- * @throws IOException
*/
private void addSecondaryRowLock(HaeinsaTransaction transaction, TRowKey primaryRowKey,
- TRowLock primaryRowLock, TRowKey secondaryRowKey) throws IOException {
+ TRowLock primaryRowLock, TRowKey secondaryRowKey) throws IOException {
TRowLock secondaryRowLock = getRowLock(secondaryRowKey.getTableName(), secondaryRowKey.getRow());
if (secondaryRowLock.getCommitTimestamp() > transaction.getCommitTimestamp()) {
// this row isn't a part of this transaction or already aborted.
diff --git a/src/main/java/kr/co/vcnc/haeinsa/exception/ConflictException.java b/src/main/java/kr/co/vcnc/haeinsa/exception/ConflictException.java
index 7164451..2ece88e 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/exception/ConflictException.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/exception/ConflictException.java
@@ -23,7 +23,6 @@
* explicitly distinguish between failure on HBase IO and conflict.
*/
public class ConflictException extends IOException {
-
private static final long serialVersionUID = -6181950952954013762L;
public ConflictException() {
diff --git a/src/main/java/kr/co/vcnc/haeinsa/exception/DanglingRowLockException.java b/src/main/java/kr/co/vcnc/haeinsa/exception/DanglingRowLockException.java
index d2ef570..0d7f736 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/exception/DanglingRowLockException.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/exception/DanglingRowLockException.java
@@ -27,7 +27,6 @@
* exception if there is fatal consistency error in Haeinsa.
*/
public class DanglingRowLockException extends ConflictException {
-
private static final long serialVersionUID = -9220580990865263679L;
private final TRowKey danglingRowKey;
@@ -51,5 +50,4 @@ public DanglingRowLockException(TRowKey danglingRowKey, String message) {
public TRowKey getDanglingRowKey() {
return danglingRowKey;
}
-
}
diff --git a/src/main/java/kr/co/vcnc/haeinsa/exception/NotExpiredYetException.java b/src/main/java/kr/co/vcnc/haeinsa/exception/NotExpiredYetException.java
index 34ce270..53aeedf 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/exception/NotExpiredYetException.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/exception/NotExpiredYetException.java
@@ -20,11 +20,9 @@
* This exception extends {@link ConflictException}
*/
public class NotExpiredYetException extends ConflictException {
-
private static final long serialVersionUID = -5160271558362505568L;
- public NotExpiredYetException() {
- }
+ public NotExpiredYetException() {}
public NotExpiredYetException(String message) {
super(message);
diff --git a/src/main/java/kr/co/vcnc/haeinsa/exception/RecoverableConflictException.java b/src/main/java/kr/co/vcnc/haeinsa/exception/RecoverableConflictException.java
index c77fd08..e516724 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/exception/RecoverableConflictException.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/exception/RecoverableConflictException.java
@@ -22,11 +22,9 @@
* because this occurs on failure of write by other transaction.
*/
public class RecoverableConflictException extends ConflictException {
-
private static final long serialVersionUID = 3720142235607540830L;
- public RecoverableConflictException() {
- }
+ public RecoverableConflictException() {}
public RecoverableConflictException(String message) {
super(message);
diff --git a/src/main/java/kr/co/vcnc/haeinsa/thrift/TRowLocks.java b/src/main/java/kr/co/vcnc/haeinsa/thrift/TRowLocks.java
index 507d94d..9f8816a 100644
--- a/src/main/java/kr/co/vcnc/haeinsa/thrift/TRowLocks.java
+++ b/src/main/java/kr/co/vcnc/haeinsa/thrift/TRowLocks.java
@@ -37,6 +37,8 @@
* TRowLock(commitTimestamp = Long.MIN_VALUE) <=> byte[] null
*/
public final class TRowLocks {
+ private TRowLocks() {}
+
private static final TProtocolFactory PROTOCOL_FACTORY = new TCompactProtocol.Factory();
private static TSerializer createSerializer() {
@@ -47,9 +49,6 @@ private static TDeserializer createDeserializer() {
return new TDeserializer(PROTOCOL_FACTORY);
}
- private TRowLocks() {
- }
-
public static TRowLock deserialize(byte[] rowLockBytes) throws IOException {
if (rowLockBytes == null) {
return new TRowLock(ROW_LOCK_VERSION, TRowLockState.STABLE, Long.MIN_VALUE);
diff --git a/src/test/java/kr/co/vcnc/haeinsa/Haeinsa67BugTest.java b/src/test/java/kr/co/vcnc/haeinsa/Haeinsa67BugTest.java
index 93fe37d..32ff3b4 100644
--- a/src/test/java/kr/co/vcnc/haeinsa/Haeinsa67BugTest.java
+++ b/src/test/java/kr/co/vcnc/haeinsa/Haeinsa67BugTest.java
@@ -46,8 +46,8 @@ public void testRecover() throws Exception {
TRowKey secondaryRowKey = new TRowKey().setTableName(testTable.getTableName()).setRow(Bytes.toBytes("Brad"));
TRowLock secondaryRowLock = new TRowLock(HaeinsaConstants.ROW_LOCK_VERSION, TRowLockState.STABLE, 1380504156137L);
TRowLock primaryRowLock = new TRowLock(HaeinsaConstants.ROW_LOCK_VERSION, TRowLockState.PREWRITTEN, 1380504157100L)
- .setCurrentTimestamp(1380504156000L)
- .setExpiry(1380504160000L);
+ .setCurrentTimestamp(1380504156000L)
+ .setExpiry(1380504160000L);
primaryRowLock.addToSecondaries(secondaryRowKey);
Put primaryPut = new Put(primaryRowKey.getRow());
primaryPut.add(HaeinsaConstants.LOCK_FAMILY, HaeinsaConstants.LOCK_QUALIFIER,
diff --git a/src/test/java/kr/co/vcnc/haeinsa/HaeinsaUnitTest.java b/src/test/java/kr/co/vcnc/haeinsa/HaeinsaUnitTest.java
index 9a8976f..ab1561d 100644
--- a/src/test/java/kr/co/vcnc/haeinsa/HaeinsaUnitTest.java
+++ b/src/test/java/kr/co/vcnc/haeinsa/HaeinsaUnitTest.java
@@ -580,8 +580,6 @@ public void testConflictAndRecover() throws Exception {
/**
* Unit test for multiple mutations for any rows in {@link HaeinsaTransaction}.
- *
- * @throws Exception
*/
@Test
public void testMultipleMutations() throws Exception {
@@ -669,8 +667,6 @@ public void testMultipleMutations() throws Exception {
/**
* Unit test for check get/scan without transaction.
- *
- * @throws Exception
*/
@Test
public void testHaeinsaTableWithoutTx() throws Exception {
- *