HBASE-3089 REST tests are broken locally and up in hudson

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1005660 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-10-07 22:54:28 +00:00
parent 58423039df
commit 8570a6af09
4 changed files with 29 additions and 21 deletions

View File

@ -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

View File

@ -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.metrics.RESTMetrics;
* 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 Constants {
*/
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 Constants {
* @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 Constants {
public void invalidateMaxAge(String tableName) {
maxAgeMap.remove(tableName);
}
}
}

View File

@ -88,6 +88,7 @@ public class HBaseRESTClusterTestBase extends HBaseClusterTestCase
if (server != null) try {
server.stop();
server = null;
RESTServlet.stop();
} catch (Exception e) {
LOG.warn(StringUtils.stringifyException(e));
}

View File

@ -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.client.RemoteHTable;
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 HBaseRESTClusterTestBase {
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 HBaseRESTClusterTestBase {
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);