You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jd...@apache.org on 2013/08/02 22:22:21 UTC
svn commit: r1509845 - in /hbase/branches/0.95:
hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
Author: jdcryans
Date: Fri Aug 2 20:22:21 2013
New Revision: 1509845
URL: http://svn.apache.org/r1509845
Log:
HBASE-8983 HBaseConnection#deleteAllConnections does not always delete (Nicolas Liochon via JD)
Modified:
hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
Modified: hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=1509845&r1=1509844&r2=1509845&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Fri Aug 2 20:22:21 2013
@@ -317,19 +317,31 @@ public class HConnectionManager {
}
/**
- * Delete information for all connections.
+ * Delete information for all connections. Close or not the connection, depending on the
+ * staleConnection boolean and the ref count. By default, you should use it with
+ * staleConnection to true.
*/
- public static void deleteAllConnections() {
+ public static void deleteAllConnections(boolean staleConnection) {
synchronized (CONNECTION_INSTANCES) {
Set<HConnectionKey> connectionKeys = new HashSet<HConnectionKey>();
connectionKeys.addAll(CONNECTION_INSTANCES.keySet());
for (HConnectionKey connectionKey : connectionKeys) {
- deleteConnection(connectionKey, false);
+ deleteConnection(connectionKey, staleConnection);
}
CONNECTION_INSTANCES.clear();
}
}
+ /**
+ * Delete information for all connections..
+ * @deprecated kept for backward compatibility, but the behavior is broken. HBASE-8983
+ */
+ @Deprecated
+ public static void deleteAllConnections() {
+ deleteAllConnections(false);
+ }
+
+
private static void deleteConnection(HConnection connection, boolean staleConnection) {
synchronized (CONNECTION_INSTANCES) {
for (Entry<HConnectionKey, HConnectionImplementation> e: CONNECTION_INSTANCES.entrySet()) {
@@ -352,7 +364,7 @@ public class HConnectionManager {
}
} else {
LOG.error("Connection not found in the list, can't delete it "+
- "(connection key=" + connectionKey + "). May be the key was modified?");
+ "(connection key=" + connectionKey + "). May be the key was modified?", new Exception());
}
}
}
Modified: hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java?rev=1509845&r1=1509844&r2=1509845&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java (original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java Fri Aug 2 20:22:21 2013
@@ -507,7 +507,7 @@ public class MiniHBaseCluster extends HB
if (this.hbaseCluster != null) {
this.hbaseCluster.shutdown();
}
- HConnectionManager.deleteAllConnections();
+ HConnectionManager.deleteAllConnections(false);
}
@Override