我反编译了驱动程序,检查H2SClient类:
public void closeSession() throws ErrorException {
if (this.m_hasOpenSession) {
try {
TCloseSessionReq var1 = new TCloseSessionReq();
var1.setSessionHandle(this.m_openSessionResp.getSessionHandle());
this.m_client.CloseSession(var1);
if (null != this.m_client && null != this.m_client.getInputProtocol() && null != this.m_client.getInputProtocol().getTransport()) {
this.m_client.getInputProtocol().getTransport().close(); //line 8
}
this.m_hasOpenSession = false;
} catch (Exception var3) {
ErrorException var2 = HiveJDBCCommonDriver.s_HiveMessages.createGeneralException(HiveJDBCMessageKey.CONN_SESSION_ERR.name(), "Close Session Error");
var2.initCause(var3);
throw var2;
}
}
}
在catch块或finally块中也应调用该关闭:
public void closeSession() throws ErrorException {
if (this.m_hasOpenSession) {
try {
TCloseSessionReq var1 = new TCloseSessionReq();
var1.setSessionHandle(this.m_openSessionResp.getSessionHandle());
this.m_client.CloseSession(var1);
var2.initCause(var3);
throw var2;
} finally {
if (null != this.m_client && null != this.m_client.getInputProtocol() && null != this.m_client.getInputProtocol().getTransport()) {
this.m_client.getInputProtocol().getTransport().close(); //line 8
}
}
}
}