Merge pull request #698 from manolama/googlebigtable

[googlebigtable] Fix #697 by synchronizing on the static Config object
This commit is contained in:
Sean Busbey 2016-04-10 14:18:25 -05:00
Родитель e5d67bf37f d9eecd20d4
Коммит c3c1e75d21
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -74,8 +74,8 @@ public class GoogleBigtableClient extends com.yahoo.ycsb.DB {
private static final String ASYNC_MAX_INFLIGHT_RPCS = "mutatorMaxInflightRPCs"; private static final String ASYNC_MAX_INFLIGHT_RPCS = "mutatorMaxInflightRPCs";
private static final String CLIENT_SIDE_BUFFERING = "clientbuffering"; private static final String CLIENT_SIDE_BUFFERING = "clientbuffering";
/** Must be an object for synchronization and tracking running thread counts. */ /** Tracks running thread counts so we know when to close the session. */
private static Integer threadCount = 0; private static int threadCount = 0;
/** This will load the hbase-site.xml config file and/or store CLI options. */ /** This will load the hbase-site.xml config file and/or store CLI options. */
private static final Configuration CONFIG = HBaseConfiguration.create(); private static final Configuration CONFIG = HBaseConfiguration.create();
@ -125,7 +125,7 @@ public class GoogleBigtableClient extends com.yahoo.ycsb.DB {
System.err.println("Running Google Bigtable with Proto API" + System.err.println("Running Google Bigtable with Proto API" +
(clientSideBuffering ? " and client side buffering." : ".")); (clientSideBuffering ? " and client side buffering." : "."));
synchronized (threadCount) { synchronized (CONFIG) {
++threadCount; ++threadCount;
if (session == null) { if (session == null) {
try { try {
@ -176,7 +176,7 @@ public class GoogleBigtableClient extends com.yahoo.ycsb.DB {
throw new DBException(e); throw new DBException(e);
} }
} }
synchronized (threadCount) { synchronized (CONFIG) {
--threadCount; --threadCount;
if (threadCount <= 0) { if (threadCount <= 0) {
try { try {