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-2734 TestFSErrors should catch all types of exceptions, not just RTE
HBASE-2738 TestTimeRangeMapRed updated now that we keep multiple cells with HBASE-2738 TestTimeRangeMapRed updated now that we keep multiple cells with
same timestamp in MemStore same timestamp in MemStore
HBASE-2725 Shutdown hook management is gone in trunk; restore
IMPROVEMENTS IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable 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. * the HMaster. There are many HRegionServers in a single HBase deployment.
*/ */
public class HRegionServer implements HRegionInterface, public class HRegionServer implements HRegionInterface,
HBaseRPCErrorHandler, Runnable, Watcher { HBaseRPCErrorHandler, Runnable, Watcher, Stoppable {
public static final Log LOG = LogFactory.getLog(HRegionServer.class); 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_EXITING = new HMsg(Type.MSG_REPORT_EXITING);
private static final HMsg REPORT_QUIESCED = new HMsg(Type.MSG_REPORT_QUIESCED); 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 // accessors will be going against wrong filesystem (unless all is set
// to defaults). // to defaults).
this.conf.set("fs.defaultFS", this.conf.get("hbase.rootdir")); 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.fs = FileSystem.get(this.conf);
this.rootDir = new Path(this.conf.get(HConstants.HBASE_DIR)); this.rootDir = new Path(this.conf.get(HConstants.HBASE_DIR));
this.hlog = setupHLog(); this.hlog = setupHLog();
@ -2396,8 +2396,10 @@ public class HRegionServer implements HRegionInterface,
/** /**
* @param hrs * @param hrs
* @return Thread the RegionServer is running in correctly named. * @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, return startRegionServer(hrs,
"regionserver" + hrs.getServerInfo().getServerAddress().getPort()); "regionserver" + hrs.getServerInfo().getServerAddress().getPort());
} }
@ -2406,12 +2408,18 @@ public class HRegionServer implements HRegionInterface,
* @param hrs * @param hrs
* @param name * @param name
* @return Thread the RegionServer is running in correctly named. * @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,
final String name) { final String name)
throws IOException {
Thread t = new Thread(hrs); Thread t = new Thread(hrs);
t.setName(name); t.setName(name);
t.start(); 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; return t;
} }
@ -2504,5 +2512,4 @@ public class HRegionServer implements HRegionInterface,
HRegionServer.class); HRegionServer.class);
doMain(args, regionServerClass); 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.util.Writables;
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper;
import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.io.MD5Hash;
import org.apache.hadoop.mapred.MiniMRCluster; import org.apache.hadoop.mapred.MiniMRCluster;
import org.apache.zookeeper.ZooKeeper; import org.apache.zookeeper.ZooKeeper;
import static org.junit.Assert.*; import static org.junit.Assert.*;