Skip to content

Commit

Permalink
修复连接不能正确释放的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wjj committed Aug 4, 2017
1 parent f0783f6 commit 912d50e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.wjj</groupId>
<artifactId>elasticsearch-jdbc</artifactId>
<packaging>jar</packaging>
<version>2.0.0</version>
<version>2.0.1</version>
<name>elasticsearch-jdbc</name>
<url>http://maven.apache.org</url>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public MybatisElasticSearchConnection(String jdbcUrl){
public void close() throws SQLException {
this.getClient().close();
logger.info("关闭连接");
System.err.println("connection close:"+Thread.currentThread().getName());
}
@Override
public DatabaseMetaData getMetaData() throws SQLException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ private void initStatement(PreparedStatementHolder stmtHolder) throws SQLExcepti
stmtHolder.incrementInUseCount();
holder.getDataSource().initStatement(this, stmtHolder.getStatement());
}
@Override
/*@Override
public void close() throws SQLException {
if (isDisable()) {
*//*if (isDisable()) {
return;
}
if(this.holder==null){
Expand All @@ -97,7 +97,11 @@ public void close() throws SQLException {
psh.getStatement().close();
}
this.holder.setDiscard(true);
this.getConnection().close();
}
this.getConnection().close();*//*
super.close();
// DruidAbstractDataSource dataSource = holder.getDataSource();
System.err.println("close:"+Thread.currentThread().getName());
// System.err.println("active:"+dataSource.getActiveConnections().size());
}*/

}

0 comments on commit 912d50e

Please sign in to comment.