Index: src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java (revision 1003206) +++ src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java (working copy) @@ -21,6 +21,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClusterTestCase; import org.apache.hadoop.util.StringUtils; import org.mortbay.jetty.Server; @@ -54,6 +55,9 @@ return; } + // Inject the conf from the test cluster by being first to make singleton + RESTServlet.getInstance(super.conf); + // set up the Jersey servlet container for Jetty ServletHolder sh = new ServletHolder(ServletContainer.class); sh.setInitParameter( Index: src/test/java/org/apache/hadoop/hbase/master/TestMultipleMasters.java =================================================================== Index: src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java (revision 1003250) +++ src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java (working copy) @@ -59,11 +59,33 @@ } /** + * @param conf Existing configuration to use in rest servlet + * @return the RESTServlet singleton instance + * @throws IOException + */ + public synchronized static RESTServlet getInstance(Configuration conf) + throws IOException { + if (instance == null) { + instance = new RESTServlet(conf); + } + return instance; + } + + /** * Constructor * @throws IOException */ public RESTServlet() throws IOException { - this.conf = HBaseConfiguration.create(); + this(HBaseConfiguration.create()); + } + + /** + * Constructor with existing configuration + * @param conf existing configuration + * @throws IOException. + */ + public RESTServlet(Configuration conf) throws IOException { + this.conf = conf; this.pool = new HTablePool(conf, 10); }