hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1005660 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java
Date Thu, 07 Oct 2010 22:54:28 GMT
Author: stack
Date: Thu Oct  7 22:54:28 2010
New Revision: 1005660

URL: http://svn.apache.org/viewvc?rev=1005660&view=rev
Log:
HBASE-3089 REST tests are broken locally and up in hudson

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1005660&r1=1005659&r2=1005660&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Oct  7 22:54:28 2010
@@ -566,10 +566,13 @@ Release 0.21.0 - Unreleased
                (Bruno Dumon via Stack)
    HBASE-2753  Remove sorted() methods from Result now that Gets are Scans
    HBASE-3059  TestReadWriteConsistencyControl occasionally hangs (Hairong 
-   	       via Ryan)
+               via Ryan)
    HBASE-2906  [rest/stargate] URI decoding in RowResource
    HBASE-3008  Memstore.updateColumnValue passes wrong flag to heapSizeChange
-   	       (Causes memstore size to go negative)
+               (Causes memstore size to go negative)
+   HBASE-3089  REST tests are broken locally and up in hudson
+  
+
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java?rev=1005660&r1=1005659&r2=1005660&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java Thu Oct  7 22:54:28
2010
@@ -24,7 +24,6 @@ import java.io.IOException;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
@@ -37,25 +36,22 @@ import org.apache.hadoop.hbase.rest.metr
  * Singleton class encapsulating global REST servlet state and functions.
  */
 public class RESTServlet implements Constants {
-
-  private static RESTServlet instance;
-
-  Configuration conf;
-  HTablePool pool;
-  AtomicBoolean stopping = new AtomicBoolean(false);
-  Map<String,Integer> maxAgeMap = 
+  private static RESTServlet INSTANCE;
+  private final Configuration conf;
+  private final HTablePool pool;
+  private final Map<String,Integer> maxAgeMap = 
     Collections.synchronizedMap(new HashMap<String,Integer>());
-  RESTMetrics metrics = new RESTMetrics();
+  private final RESTMetrics metrics = new RESTMetrics();
 
   /**
    * @return the RESTServlet singleton instance
    * @throws IOException
    */
   public synchronized static RESTServlet getInstance() throws IOException {
-    if (instance == null) {
-      instance = new RESTServlet();
+    if (INSTANCE == null) {
+      INSTANCE = new RESTServlet();
     }
-    return instance;
+    return INSTANCE;
   }
 
   /**
@@ -65,17 +61,21 @@ public class RESTServlet implements Cons
    */
   public synchronized static RESTServlet getInstance(Configuration conf)
   throws IOException {
-    if (instance == null) {
-      instance = new RESTServlet(conf);
+    if (INSTANCE == null) {
+      INSTANCE = new RESTServlet(conf);
     }
-    return instance;
+    return INSTANCE;
+  }
+
+  public synchronized static void stop() {
+    if (INSTANCE != null)  INSTANCE = null;
   }
 
   /**
    * Constructor
    * @throws IOException
    */
-  public RESTServlet() throws IOException {
+  RESTServlet() throws IOException {
     this(HBaseConfiguration.create());
   }
   
@@ -84,7 +84,7 @@ public class RESTServlet implements Cons
    * @param conf existing configuration
    * @throws IOException.
    */
-  public RESTServlet(Configuration conf) throws IOException {
+  RESTServlet(Configuration conf) throws IOException {
     this.conf = conf;
     this.pool = new HTablePool(conf, 10);
   }
@@ -140,4 +140,4 @@ public class RESTServlet implements Cons
   public void invalidateMaxAge(String tableName) {
     maxAgeMap.remove(tableName);
   }
-}
+}
\ No newline at end of file

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java?rev=1005660&r1=1005659&r2=1005660&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java Thu
Oct  7 22:54:28 2010
@@ -88,6 +88,7 @@ public class HBaseRESTClusterTestBase ex
     if (server != null) try {
       server.stop();
       server = null;
+      RESTServlet.stop();
     } catch (Exception e) {
       LOG.warn(StringUtils.stringifyException(e));
     }

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java?rev=1005660&r1=1005659&r2=1005660&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java Thu
Oct  7 22:54:28 2010
@@ -24,6 +24,8 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
@@ -42,7 +44,7 @@ import org.apache.hadoop.hbase.rest.clie
 import org.apache.hadoop.hbase.util.Bytes;
 
 public class TestRemoteTable extends HBaseRESTClusterTestBase {
-
+  private static final Log LOG = LogFactory.getLog(HBaseRESTClusterTestBase.class);
   static final String TABLE = "TestRemoteTable";
   static final byte[] ROW_1 = Bytes.toBytes("testrow1");
   static final byte[] ROW_2 = Bytes.toBytes("testrow2");
@@ -71,6 +73,7 @@ public class TestRemoteTable extends HBa
     super.setUp();
     
     admin = new HBaseAdmin(conf);
+    LOG.info("Admin Connection=" + admin.getConnection() + ", " + admin.getConnection().getZooKeeperWatcher());
     if (!admin.tableExists(TABLE)) {
       HTableDescriptor htd = new HTableDescriptor(TABLE);
       htd.addFamily(new HColumnDescriptor(COLUMN_1));
@@ -78,6 +81,7 @@ public class TestRemoteTable extends HBa
       htd.addFamily(new HColumnDescriptor(COLUMN_3));
       admin.createTable(htd);
       HTable table = new HTable(conf, TABLE);
+      LOG.info("Table connection=" + table.getConnection() + ", " + admin.getConnection().getZooKeeperWatcher());
       Put put = new Put(ROW_1);
       put.add(COLUMN_1, QUALIFIER_1, TS_2, VALUE_1);
       table.put(put);



Mime
View raw message