Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegionServer.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegionServer.java (revision 577399) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegionServer.java (working copy) @@ -67,6 +67,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable { static final Log LOG = LogFactory.getLog(HRegionServer.class); + /** {@inheritDoc} */ public long getProtocolVersion(final String protocol, @SuppressWarnings("unused") final long clientVersion) throws IOException { @@ -141,6 +142,9 @@ private HTable root = null; private HTable meta = null; + /** + * @param stop + */ public SplitOrCompactChecker(final AtomicBoolean stop) { super(conf.getInt("hbase.regionserver.thread.splitcompactcheckfrequency", 30 * 1000), stop); @@ -146,6 +150,7 @@ 30 * 1000), stop); } + /** {@inheritDoc} */ public void closing(final Text regionName) { lock.writeLock().lock(); try { @@ -161,6 +166,7 @@ } } + /** {@inheritDoc} */ public void closed(final Text regionName) { lock.writeLock().lock(); try { @@ -176,6 +182,7 @@ /** * Scan for splits or compactions to run. Run any we find. */ + @Override protected void chore() { // Don't interrupt us while we're working synchronized (splitOrCompactLock) { @@ -275,6 +282,10 @@ /* Runs periodically to flush memcache. */ class Flusher extends Chore { + /** + * @param period + * @param stop + */ public Flusher(final int period, final AtomicBoolean stop) { super(period, stop); } @@ -279,6 +290,8 @@ super(period, stop); } + /** {@inheritDoc} */ + @Override protected void chore() { synchronized(cacheFlusherLock) { checkForFlushesToRun(); @@ -323,6 +336,10 @@ private int MAXLOGENTRIES = conf.getInt("hbase.regionserver.maxlogentries", 30 * 1000); + /** + * @param period + * @param stop + */ public LogRoller(final int period, final AtomicBoolean stop) { super(period, stop); } @@ -327,6 +344,8 @@ super(period, stop); } + /** {@inheritDoc} */ + @Override protected void chore() { synchronized(logRollerLock) { checkForLogRoll(); @@ -799,6 +818,7 @@ } } + /** {@inheritDoc} */ public void run() { try { for(ToDoEntry e = null; !stopRequested.get(); ) { @@ -1243,7 +1263,8 @@ this.lock.readLock().unlock(); } } - + + private Integer checkFileSystemLock = new Integer(0); /** * Checks to see if the file system is still accessible. * If not, sets abortRequested and stopRequested @@ -1250,13 +1271,15 @@ * * @return false if file system is not available */ - protected synchronized boolean checkFileSystem() { + protected boolean checkFileSystem() { if (this.fsOk) { - if (!FSUtils.isFileSystemAvailable(fs)) { - LOG.fatal("Shutting down HRegionServer: file system not available"); - this.abortRequested = true; - this.stopRequested.set(true); - fsOk = false; + synchronized (checkFileSystemLock) { + if (!FSUtils.isFileSystemAvailable(fs)) { + LOG.fatal("Shutting down HRegionServer: file system not available"); + this.abortRequested = true; + this.stopRequested.set(true); + fsOk = false; + } } } return this.fsOk; Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/AbstractMergeTestBase.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/AbstractMergeTestBase.java (revision 577399) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/AbstractMergeTestBase.java (working copy) @@ -119,6 +119,9 @@ if (dfsCluster != null) { dfsCluster.shutdown(); } + if (fs != null) { + fs.close(); + } } private HRegion createAregion(Text startKey, Text endKey, int firstRow, Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java (revision 577399) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java (working copy) @@ -84,6 +84,9 @@ /** * Starts a MiniHBaseCluster on top of an existing HDFSCluster * + * Note that if you use this constructor, you should shut down the mini dfs + * cluster in your test case. + * * @param conf * @param nRegionNodes * @param dfsCluster @@ -93,7 +96,8 @@ MiniDFSCluster dfsCluster) throws IOException { this.conf = conf; - this.cluster = dfsCluster; + this.fs = dfsCluster.getFileSystem(); + this.cluster = null; init(nRegionNodes); } @@ -116,6 +120,10 @@ this.deleteOnExit = deleteOnExit; if (miniHdfsFilesystem) { this.cluster = new MiniDFSCluster(this.conf, 2, format, (String[])null); + this.fs = cluster.getFileSystem(); + } else { + this.cluster = null; + this.fs = FileSystem.get(conf); } init(nRegionNodes); } @@ -122,7 +130,6 @@ private void init(final int nRegionNodes) throws IOException { try { - this.fs = FileSystem.get(conf); this.parentdir = new Path(conf.get(HBASE_DIR, DEFAULT_HBASE_DIR)); fs.mkdirs(parentdir); this.masterThread = startMaster(this.conf); Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestHBaseShell.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestHBaseShell.java (revision 577399) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestHBaseShell.java (working copy) @@ -43,6 +43,7 @@ private ByteArrayOutputStream baos; private HBaseAdmin admin; + /** constructor */ public TestHBaseShell() { super(1 /*One region server only*/); } @@ -47,6 +48,7 @@ super(1 /*One region server only*/); } + /** {@inheritDoc} */ @Override public void setUp() throws Exception { super.setUp(); @@ -100,6 +102,9 @@ sglQuotedColumnFamily + "');", tmpTableName, sglQuotedColumnFamily); } + /** + * @throws Exception + */ public void testInsertSelectDelete() throws Exception { final String tableName = getName(); final String columnFamily = tableName; Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestBatchUpdate.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestBatchUpdate.java (revision 577399) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestBatchUpdate.java (working copy) @@ -40,6 +40,7 @@ * @throws UnsupportedEncodingException */ public TestBatchUpdate() throws UnsupportedEncodingException { + super(); value = "abcd".getBytes(HConstants.UTF8_ENCODING); } Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestDFSAbort.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestDFSAbort.java (revision 577399) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestDFSAbort.java (working copy) @@ -60,7 +60,10 @@ cluster.join(); } - public static void main(String[] args) { + /** + * @param args unused + */ + public static void main(@SuppressWarnings("unused") String[] args) { TestRunner.run(new TestSuite(TestDFSAbort.class)); } } Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestScanner2.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestScanner2.java (revision 577399) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestScanner2.java (working copy) @@ -177,7 +177,7 @@ HBaseAdmin admin = new HBaseAdmin(conf); Text tableName = new Text(getName()); admin.createTable(new HTableDescriptor(tableName.toString())); - List regions = scan(conf, metaTable); + List regions = scan(metaTable); assertEquals("Expected one region", regions.size(), 1); HRegionInfo region = regions.get(0); assertTrue("Expected region named for test", @@ -197,10 +197,10 @@ homedir, this.conf, null)); try { for (HRegion r : newRegions) { - addRegionToMETA(conf, metaTable, r, this.cluster.getHMasterAddress(), + addRegionToMETA(metaTable, r, this.cluster.getHMasterAddress(), -1L); } - regions = scan(conf, metaTable); + regions = scan(metaTable); assertEquals("Should be two regions only", 2, regions.size()); } finally { for (HRegion r : newRegions) { @@ -210,7 +210,7 @@ } } - private List scan(final Configuration conf, final HTable t) + private List scan(final HTable t) throws IOException { List regions = new ArrayList(); HRegionInterface regionServer = null; @@ -262,8 +262,7 @@ return regions; } - private void addRegionToMETA(final Configuration conf, - final HTable t, final HRegion region, + private void addRegionToMETA(final HTable t, final HRegion region, final HServerAddress serverAddress, final long startCode) throws IOException { Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestSplit.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestSplit.java (revision 577399) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestSplit.java (working copy) @@ -32,7 +32,8 @@ * {@Link TestHRegion} does a split but this TestCase adds testing of fast * split and manufactures odd-ball split scenarios. */ -public class TestSplit extends HBaseTestCase { +public class TestSplit extends MultiRegionTable { + @SuppressWarnings("hiding") static final Log LOG = LogFactory.getLog(TestSplit.class.getName()); /** constructor */ Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestTableMapReduce.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestTableMapReduce.java (revision 577399) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestTableMapReduce.java (working copy) @@ -45,7 +45,8 @@ /** * Test Map/Reduce job over HBase tables */ -public class TestTableMapReduce extends HBaseTestCase { +public class TestTableMapReduce extends MultiRegionTable { + @SuppressWarnings("hiding") private static final Log LOG = LogFactory.getLog(TestTableMapReduce.class.getName()); @@ -115,6 +116,10 @@ if (dfsCluster != null) { dfsCluster.shutdown(); } + + if (fs != null) { + fs.close(); + } } /** @@ -254,7 +259,7 @@ admin.createTable(desc); // Populate a table into multiple regions - MultiRegionTable.makeMultiRegionTable(conf, hCluster, null, + MultiRegionTable.makeMultiRegionTable(conf, hCluster, fs, MULTI_REGION_TABLE_NAME, INPUT_COLUMN); // Verify table indeed has multiple regions