Skip to content
Snippets Groups Projects
Commit d9eecd20 authored by Chris Larsen's avatar Chris Larsen
Browse files

[googlebigtable] Fix #697 by synchronizing on the static Config object

who's address does not change.
parent e5d67bf3
No related branches found
No related tags found
No related merge requests found
...@@ -74,8 +74,8 @@ public class GoogleBigtableClient extends com.yahoo.ycsb.DB { ...@@ -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 { ...@@ -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 { ...@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment