From 912d50ef6da9ab0cdb49701fb1c96879f769d46d Mon Sep 17 00:00:00 2001 From: wjj Date: Fri, 4 Aug 2017 09:34:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=9E=E6=8E=A5=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E6=AD=A3=E7=A1=AE=E9=87=8A=E6=94=BE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../druid/pool/MybatisElasticSearchConnection.java | 1 + .../MybatisElasticSearchDruidPooledConnection.java | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 403f11e..7a1d1e0 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.wjj elasticsearch-jdbc jar - 2.0.0 + 2.0.1 elasticsearch-jdbc http://maven.apache.org diff --git a/src/main/java/com/alibaba/druid/pool/MybatisElasticSearchConnection.java b/src/main/java/com/alibaba/druid/pool/MybatisElasticSearchConnection.java index 1fbe848..d5c2e1c 100644 --- a/src/main/java/com/alibaba/druid/pool/MybatisElasticSearchConnection.java +++ b/src/main/java/com/alibaba/druid/pool/MybatisElasticSearchConnection.java @@ -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 { diff --git a/src/main/java/com/alibaba/druid/pool/MybatisElasticSearchDruidPooledConnection.java b/src/main/java/com/alibaba/druid/pool/MybatisElasticSearchDruidPooledConnection.java index 326c52f..fd98bab 100644 --- a/src/main/java/com/alibaba/druid/pool/MybatisElasticSearchDruidPooledConnection.java +++ b/src/main/java/com/alibaba/druid/pool/MybatisElasticSearchDruidPooledConnection.java @@ -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){ @@ -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()); + }*/ }