HBASE-2725 Shutdown hook management is gone in trunk; restore

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@955426 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-06-16 23:31:36 +00:00
parent 3fc4397289
commit bbe4d7981f
3 changed files with 14 additions and 7 deletions

View File

@ -393,6 +393,7 @@ Release 0.21.0 - Unreleased
HBASE-2734 TestFSErrors should catch all types of exceptions, not just RTE
HBASE-2738 TestTimeRangeMapRed updated now that we keep multiple cells with
same timestamp in MemStore
HBASE-2725 Shutdown hook management is gone in trunk; restore
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -117,7 +117,7 @@ import org.apache.zookeeper.Watcher.Event.KeeperState;
* the HMaster. There are many HRegionServers in a single HBase deployment.
*/
public class HRegionServer implements HRegionInterface,
HBaseRPCErrorHandler, Runnable, Watcher {
HBaseRPCErrorHandler, Runnable, Watcher, Stoppable {
public static final Log LOG = LogFactory.getLog(HRegionServer.class);
private static final HMsg REPORT_EXITING = new HMsg(Type.MSG_REPORT_EXITING);
private static final HMsg REPORT_QUIESCED = new HMsg(Type.MSG_REPORT_QUIESCED);
@ -725,7 +725,7 @@ public class HRegionServer implements HRegionInterface,
// accessors will be going against wrong filesystem (unless all is set
// to defaults).
this.conf.set("fs.defaultFS", this.conf.get("hbase.rootdir"));
this.conf.setBoolean("fs.automatic.close", false);
// Get fs instance used by this RS
this.fs = FileSystem.get(this.conf);
this.rootDir = new Path(this.conf.get(HConstants.HBASE_DIR));
this.hlog = setupHLog();
@ -2396,8 +2396,10 @@ public class HRegionServer implements HRegionInterface,
/**
* @param hrs
* @return Thread the RegionServer is running in correctly named.
* @throws IOException
*/
public static Thread startRegionServer(final HRegionServer hrs) {
public static Thread startRegionServer(final HRegionServer hrs)
throws IOException {
return startRegionServer(hrs,
"regionserver" + hrs.getServerInfo().getServerAddress().getPort());
}
@ -2406,12 +2408,18 @@ public class HRegionServer implements HRegionInterface,
* @param hrs
* @param name
* @return Thread the RegionServer is running in correctly named.
* @throws IOException
*/
public static Thread startRegionServer(final HRegionServer hrs,
final String name) {
final String name)
throws IOException {
Thread t = new Thread(hrs);
t.setName(name);
t.start();
// Install shutdown hook that will catch signals and run an orderly shutdown
// of the hrs.
ShutdownHook.install(hrs.getConfiguration(),
FileSystem.get(hrs.getConfiguration()), hrs, t);
return t;
}
@ -2504,5 +2512,4 @@ public class HRegionServer implements HRegionInterface,
HRegionServer.class);
doMain(args, regionServerClass);
}
}
}

View File

@ -49,7 +49,6 @@ import org.apache.hadoop.hbase.util.FSUtils;
import org.apache.hadoop.hbase.util.Writables;
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.io.MD5Hash;
import org.apache.hadoop.mapred.MiniMRCluster;
import org.apache.zookeeper.ZooKeeper;
import static org.junit.Assert.*;