From 0f708f7370f47b739585b54cd19c8da241fe3f9e Mon Sep 17 00:00:00 2001 From: larsh Date: Wed, 22 Feb 2012 07:00:44 +0000 Subject: [PATCH] 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 --- .../org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java | 6 +++--- .../java/org/apache/hadoop/hbase/mapreduce/ImportTsv.java | 4 ++-- .../apache/hadoop/hbase/master/DefaultLoadBalancer.java | 2 +- .../org/apache/hadoop/hbase/master/SplitLogManager.java | 2 +- .../hbase/regionserver/wal/SequenceFileLogWriter.java | 8 ++++---- .../hadoop/hbase/zookeeper/MasterSchemaChangeTracker.java | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java b/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java index c31429de965..6d343617a4a 100644 --- a/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java +++ b/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java @@ -111,9 +111,9 @@ public class SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize { // Proportions we allocate to each slab of the total size. String[] porportions = conf.getStrings( "hbase.offheapcache.slab.proportions", "0.80", "0.20"); - String[] sizes = conf.getStrings("hbase.offheapcache.slab.sizes", new Long( - avgBlockSize * 11 / 10).toString(), new Long(avgBlockSize * 21 / 10) - .toString()); + String[] sizes = conf.getStrings("hbase.offheapcache.slab.sizes", + Long.valueOf(avgBlockSize * 11 / 10).toString(), + Long.valueOf(avgBlockSize * 21 / 10).toString()); if (porportions.length != sizes.length) { throw new IllegalArgumentException( diff --git a/src/main/java/org/apache/hadoop/hbase/mapreduce/ImportTsv.java b/src/main/java/org/apache/hadoop/hbase/mapreduce/ImportTsv.java index bfe18e76258..aed7846253a 100644 --- a/src/main/java/org/apache/hadoop/hbase/mapreduce/ImportTsv.java +++ b/src/main/java/org/apache/hadoop/hbase/mapreduce/ImportTsv.java @@ -198,8 +198,8 @@ public class ImportTsv { // by re-encoding the passed separator as a Base64 string. String actualSeparator = conf.get(SEPARATOR_CONF_KEY); if (actualSeparator != null) { - conf.set(SEPARATOR_CONF_KEY, new String( - Base64.encodeBytes(actualSeparator.getBytes()))); + conf.set(SEPARATOR_CONF_KEY, + Base64.encodeBytes(actualSeparator.getBytes())); } // See if a non-default Mapper was set diff --git a/src/main/java/org/apache/hadoop/hbase/master/DefaultLoadBalancer.java b/src/main/java/org/apache/hadoop/hbase/master/DefaultLoadBalancer.java index d64e1476fd4..702f622765a 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/DefaultLoadBalancer.java +++ b/src/main/java/org/apache/hadoop/hbase/master/DefaultLoadBalancer.java @@ -106,7 +106,7 @@ public class DefaultLoadBalancer implements LoadBalancer { * regions which were assigned to the server after some other region server * crashed. */ - private class RegionInfoComparator implements Comparator { + private static class RegionInfoComparator implements Comparator { @Override public int compare(HRegionInfo l, HRegionInfo r) { long diff = r.getRegionId() - l.getRegionId(); diff --git a/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java b/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java index 5489402ce3a..79862c50165 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java +++ b/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java @@ -608,7 +608,7 @@ public class SplitLogManager extends ZooKeeperListener { create(ZKSplitLog.getRescanNode(watcher), TaskState.TASK_DONE.get(serverName), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL, - new CreateRescanAsyncCallback(), new Long(retries)); + new CreateRescanAsyncCallback(), Long.valueOf(retries)); } private void createRescanSuccess(String path) { diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SequenceFileLogWriter.java b/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SequenceFileLogWriter.java index cbef70f1592..bd31ead1af5 100644 --- a/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SequenceFileLogWriter.java +++ b/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SequenceFileLogWriter.java @@ -91,13 +91,13 @@ public class SequenceFileLogWriter implements HLog.Writer { CompressionType.class, CompressionCodec.class, Metadata.class}) .invoke(null, new Object[] {fs, conf, path, HLog.getKeyClass(conf), WALEdit.class, - new Integer(fs.getConf().getInt("io.file.buffer.size", 4096)), - new Short((short) + Integer.valueOf(fs.getConf().getInt("io.file.buffer.size", 4096)), + Short.valueOf((short) conf.getInt("hbase.regionserver.hlog.replication", fs.getDefaultReplication())), - new Long(conf.getLong("hbase.regionserver.hlog.blocksize", + Long.valueOf(conf.getLong("hbase.regionserver.hlog.blocksize", fs.getDefaultBlockSize())), - new Boolean(false) /*createParent*/, + Boolean.valueOf(false) /*createParent*/, SequenceFile.CompressionType.NONE, new DefaultCodec(), new Metadata() }); diff --git a/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterSchemaChangeTracker.java b/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterSchemaChangeTracker.java index 7d0ae631626..39c940e45c0 100644 --- a/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterSchemaChangeTracker.java +++ b/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterSchemaChangeTracker.java @@ -743,7 +743,7 @@ public class MasterSchemaChangeTracker extends ZooKeeperNodeTracker { LOG.debug("Removing RS " + schemaAlterStatus.getHostName() + " from schema change process."); hostsToProcess = - new String(hostsToProcess).replaceAll(schemaAlterStatus.getHostName(), ""); + hostsToProcess.replaceAll(schemaAlterStatus.getHostName(), ""); int ignoreRegionsCount = schemaAlterStatus.getNumberOfOnlineRegions(); LOG.debug("Current number of regions processed = " + this.numberOfRegionsProcessed + " deducting ignored = "