HBASE-16638 Reduce the number of Connection's created in classes of hbase-spark module - Addendum (Weiqing Yang)

This commit is contained in:
tedyu 2016-10-11 10:22:50 -07:00
parent 9d304d3b2d
commit ee6f0ddef6
2 changed files with 3 additions and 3 deletions

View File

@ -79,14 +79,14 @@ private[spark] object HBaseConnectionCache extends Logging {
connectionMap.foreach {
x => {
if(x._2.refCount < 0) {
logError("Bug to be fixed: negative refCount")
logError(s"Bug to be fixed: negative refCount of connection ${x._2}")
}
if(forceClean || ((x._2.refCount <= 0) && (tsNow - x._2.timestamp > timeout))) {
try{
x._2.connection.close()
} catch {
case e: IOException => logWarning("Fail to close connection", e)
case e: IOException => logWarning(s"Fail to close connection ${x._2}", e)
}
connectionMap.remove(x._1)
}

View File

@ -61,7 +61,7 @@ class ConnectionMocker extends Connection {
def abort(why: String, e: Throwable) = {}
}
class HBaseConnectionCacheSuit extends FunSuite with Logging {
class HBaseConnectionCacheSuite extends FunSuite with Logging {
/*
* These tests must be performed sequentially as they operate with an
* unique running thread and resource.