HBASE-7002 Fix all 4 findbug performance warnings (Liang Xie)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1399514 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-10-18 04:34:32 +00:00
parent a7f9aa0c25
commit f065232db0
4 changed files with 11 additions and 13 deletions

View File

@ -963,12 +963,11 @@ public class HBaseAdmin implements Abortable, Closeable {
return execute(new MasterMonitorCallable<Pair<Integer, Integer>>() {
@Override
public Pair<Integer, Integer> call() throws ServiceException {
GetSchemaAlterStatusRequest req =
RequestConverter.buildGetSchemaAlterStatusRequest(tableName);
GetSchemaAlterStatusResponse ret = masterMonitor.getSchemaAlterStatus(null,req);
Pair<Integer,Integer> pair =
new Pair<Integer,Integer>(
new Integer(ret.getYetToUpdateRegions()),new Integer(ret.getTotalRegions()));
GetSchemaAlterStatusRequest req = RequestConverter
.buildGetSchemaAlterStatusRequest(tableName);
GetSchemaAlterStatusResponse ret = masterMonitor.getSchemaAlterStatus(null, req);
Pair<Integer, Integer> pair = new Pair<Integer, Integer>(Integer.valueOf(ret
.getYetToUpdateRegions()), Integer.valueOf(ret.getTotalRegions()));
return pair;
}
});

View File

@ -1133,7 +1133,7 @@ public abstract class HBaseServer implements RpcServer {
SaslServer saslServer;
private boolean useWrap = false;
// Fake 'call' for failed authorization response
private final int AUTHROIZATION_FAILED_CALLID = -1;
private static final int AUTHROIZATION_FAILED_CALLID = -1;
private final Call authFailedCall = new Call(AUTHROIZATION_FAILED_CALLID,
null, this, null, 0, null);
private ByteArrayOutputStream authFailedResponse =

View File

@ -557,11 +557,10 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
double value = 0;
// Compute the min, value, and max.
for (String tableName : tableRegionsTotal.keySet()) {
max += tableRegionsTotal.get(tableName).doubleValue();
min += tableRegionsTotal.get(tableName).doubleValue() / (double) clusterState.size();
value += tableCostSeenSoFar.get(tableName).doubleValue();
for (Entry<String, MutableInt> currentEntry : tableRegionsTotal.entrySet()) {
max += tableRegionsTotal.get(currentEntry.getKey()).doubleValue();
min += tableRegionsTotal.get(currentEntry.getKey()).doubleValue() / clusterState.size();
value += tableCostSeenSoFar.get(currentEntry.getKey()).doubleValue();
}
return scale(min, max, value);
}

View File

@ -223,7 +223,7 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
Long value = countersMap.remove(key);
if (value == null) {
// There was nothing there, create a new value
value = new Long(currentAmount);
value = Long.valueOf(currentAmount);
} else {
value += currentAmount;
successfulCoalescings.incrementAndGet();