HBASE-5439 Fix some performance findbugs issues (Gregory Chanan)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1292141 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
larsh 2012-02-22 07:00:44 +00:00
parent 953d89e3a9
commit 0f708f7370
6 changed files with 12 additions and 12 deletions

View File

@ -111,9 +111,9 @@ public class SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize {
// Proportions we allocate to each slab of the total size. // Proportions we allocate to each slab of the total size.
String[] porportions = conf.getStrings( String[] porportions = conf.getStrings(
"hbase.offheapcache.slab.proportions", "0.80", "0.20"); "hbase.offheapcache.slab.proportions", "0.80", "0.20");
String[] sizes = conf.getStrings("hbase.offheapcache.slab.sizes", new Long( String[] sizes = conf.getStrings("hbase.offheapcache.slab.sizes",
avgBlockSize * 11 / 10).toString(), new Long(avgBlockSize * 21 / 10) Long.valueOf(avgBlockSize * 11 / 10).toString(),
.toString()); Long.valueOf(avgBlockSize * 21 / 10).toString());
if (porportions.length != sizes.length) { if (porportions.length != sizes.length) {
throw new IllegalArgumentException( throw new IllegalArgumentException(

View File

@ -198,8 +198,8 @@ public class ImportTsv {
// by re-encoding the passed separator as a Base64 string. // by re-encoding the passed separator as a Base64 string.
String actualSeparator = conf.get(SEPARATOR_CONF_KEY); String actualSeparator = conf.get(SEPARATOR_CONF_KEY);
if (actualSeparator != null) { if (actualSeparator != null) {
conf.set(SEPARATOR_CONF_KEY, new String( conf.set(SEPARATOR_CONF_KEY,
Base64.encodeBytes(actualSeparator.getBytes()))); Base64.encodeBytes(actualSeparator.getBytes()));
} }
// See if a non-default Mapper was set // See if a non-default Mapper was set

View File

@ -106,7 +106,7 @@ public class DefaultLoadBalancer implements LoadBalancer {
* regions which were assigned to the server after some other region server * regions which were assigned to the server after some other region server
* crashed. * crashed.
*/ */
private class RegionInfoComparator implements Comparator<HRegionInfo> { private static class RegionInfoComparator implements Comparator<HRegionInfo> {
@Override @Override
public int compare(HRegionInfo l, HRegionInfo r) { public int compare(HRegionInfo l, HRegionInfo r) {
long diff = r.getRegionId() - l.getRegionId(); long diff = r.getRegionId() - l.getRegionId();

View File

@ -608,7 +608,7 @@ public class SplitLogManager extends ZooKeeperListener {
create(ZKSplitLog.getRescanNode(watcher), create(ZKSplitLog.getRescanNode(watcher),
TaskState.TASK_DONE.get(serverName), Ids.OPEN_ACL_UNSAFE, TaskState.TASK_DONE.get(serverName), Ids.OPEN_ACL_UNSAFE,
CreateMode.EPHEMERAL_SEQUENTIAL, CreateMode.EPHEMERAL_SEQUENTIAL,
new CreateRescanAsyncCallback(), new Long(retries)); new CreateRescanAsyncCallback(), Long.valueOf(retries));
} }
private void createRescanSuccess(String path) { private void createRescanSuccess(String path) {

View File

@ -91,13 +91,13 @@ public class SequenceFileLogWriter implements HLog.Writer {
CompressionType.class, CompressionCodec.class, Metadata.class}) CompressionType.class, CompressionCodec.class, Metadata.class})
.invoke(null, new Object[] {fs, conf, path, HLog.getKeyClass(conf), .invoke(null, new Object[] {fs, conf, path, HLog.getKeyClass(conf),
WALEdit.class, WALEdit.class,
new Integer(fs.getConf().getInt("io.file.buffer.size", 4096)), Integer.valueOf(fs.getConf().getInt("io.file.buffer.size", 4096)),
new Short((short) Short.valueOf((short)
conf.getInt("hbase.regionserver.hlog.replication", conf.getInt("hbase.regionserver.hlog.replication",
fs.getDefaultReplication())), fs.getDefaultReplication())),
new Long(conf.getLong("hbase.regionserver.hlog.blocksize", Long.valueOf(conf.getLong("hbase.regionserver.hlog.blocksize",
fs.getDefaultBlockSize())), fs.getDefaultBlockSize())),
new Boolean(false) /*createParent*/, Boolean.valueOf(false) /*createParent*/,
SequenceFile.CompressionType.NONE, new DefaultCodec(), SequenceFile.CompressionType.NONE, new DefaultCodec(),
new Metadata() new Metadata()
}); });

View File

@ -743,7 +743,7 @@ public class MasterSchemaChangeTracker extends ZooKeeperNodeTracker {
LOG.debug("Removing RS " + schemaAlterStatus.getHostName() LOG.debug("Removing RS " + schemaAlterStatus.getHostName()
+ " from schema change process."); + " from schema change process.");
hostsToProcess = hostsToProcess =
new String(hostsToProcess).replaceAll(schemaAlterStatus.getHostName(), ""); hostsToProcess.replaceAll(schemaAlterStatus.getHostName(), "");
int ignoreRegionsCount = schemaAlterStatus.getNumberOfOnlineRegions(); int ignoreRegionsCount = schemaAlterStatus.getNumberOfOnlineRegions();
LOG.debug("Current number of regions processed = " LOG.debug("Current number of regions processed = "
+ this.numberOfRegionsProcessed + " deducting ignored = " + this.numberOfRegionsProcessed + " deducting ignored = "