HBASE-5255 Use singletons for OperationStatus to save memory (Benoit)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1235016 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
de42b015a4
commit
59b1b68d12
|
@ -10,11 +10,12 @@ Release 0.92.1 - Unreleased
|
|||
HBASE-5235 HLogSplitter writer thread's streams not getting closed when any
|
||||
of the writer threads has exceptions. (Ram)
|
||||
HBASE-5243 LogSyncerThread not getting shutdown waiting for the interrupted flag (Ram)
|
||||
HBASE-5255 Use singletons for OperationStatus to save memory (Benoit)
|
||||
|
||||
TESTS
|
||||
HBASE-5223 TestMetaReaderEditor is missing call to CatalogTracker.stop()
|
||||
|
||||
Release 0.92.0 - Unreleased
|
||||
Release 0.92.0 - 01/23/2012
|
||||
INCOMPATIBLE CHANGES
|
||||
HBASE-2002 Coprocessors: Client side support; Support RPC interface
|
||||
changes at runtime (Gary Helmling via Andrew Purtell)
|
||||
|
|
|
@ -1907,8 +1907,7 @@ public class HRegion implements HeapSize { // , Writable{
|
|||
public BatchOperationInProgress(T[] operations) {
|
||||
this.operations = operations;
|
||||
this.retCodeDetails = new OperationStatus[operations.length];
|
||||
Arrays.fill(this.retCodeDetails, new OperationStatus(
|
||||
OperationStatusCode.NOT_RUN));
|
||||
Arrays.fill(this.retCodeDetails, OperationStatus.NOT_RUN);
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
|
@ -1983,8 +1982,7 @@ public class HRegion implements HeapSize { // , Writable{
|
|||
if (coprocessorHost.prePut(put, walEdit, put.getWriteToWAL())) {
|
||||
// pre hook says skip this Put
|
||||
// mark as success and skip below
|
||||
batchOp.retCodeDetails[i] = new OperationStatus(
|
||||
OperationStatusCode.SUCCESS);
|
||||
batchOp.retCodeDetails[i] = OperationStatus.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2127,7 +2125,7 @@ public class HRegion implements HeapSize { // , Writable{
|
|||
!= OperationStatusCode.NOT_RUN) {
|
||||
continue;
|
||||
}
|
||||
batchOp.retCodeDetails[i] = new OperationStatus(OperationStatusCode.SUCCESS);
|
||||
batchOp.retCodeDetails[i] = OperationStatus.SUCCESS;
|
||||
|
||||
Put p = batchOp.operations[i].getFirst();
|
||||
if (!p.getWriteToWAL()) continue;
|
||||
|
@ -2218,8 +2216,7 @@ public class HRegion implements HeapSize { // , Writable{
|
|||
if (!success) {
|
||||
for (int i = firstIndex; i < lastIndexExclusive; i++) {
|
||||
if (batchOp.retCodeDetails[i].getOperationStatusCode() == OperationStatusCode.NOT_RUN) {
|
||||
batchOp.retCodeDetails[i] = new OperationStatus(
|
||||
OperationStatusCode.FAILURE);
|
||||
batchOp.retCodeDetails[i] = OperationStatus.FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,9 +30,21 @@ import org.apache.hadoop.hbase.HConstants.OperationStatusCode;
|
|||
*/
|
||||
public class OperationStatus {
|
||||
|
||||
private OperationStatusCode code;
|
||||
/** Singleton for successful operations. */
|
||||
static final OperationStatus SUCCESS =
|
||||
new OperationStatus(OperationStatusCode.SUCCESS);
|
||||
|
||||
private String exceptionMsg;
|
||||
/** Singleton for failed operations. */
|
||||
static final OperationStatus FAILURE =
|
||||
new OperationStatus(OperationStatusCode.FAILURE);
|
||||
|
||||
/** Singleton for operations not yet run. */
|
||||
static final OperationStatus NOT_RUN =
|
||||
new OperationStatus(OperationStatusCode.NOT_RUN);
|
||||
|
||||
private final OperationStatusCode code;
|
||||
|
||||
private final String exceptionMsg;
|
||||
|
||||
public OperationStatus(OperationStatusCode code) {
|
||||
this(code, "");
|
||||
|
|
Loading…
Reference in New Issue