Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b8ab80

Browse files
author
zhaoguang
committed
fix bug#connection in druid infinitely increased
1 parent c69f4d2 commit 0b8ab80

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/com/alibaba/druid/pool/ElasticSearchConnection.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
public class ElasticSearchConnection implements Connection {
2424

2525
private Client client;
26+
//关闭标识
27+
private boolean closeStatus = true;
2628

2729
public ElasticSearchConnection(String jdbcUrl, Properties info) {
2830

@@ -41,6 +43,7 @@ public ElasticSearchConnection(String jdbcUrl, Properties info) {
4143
transportClient.addTransportAddress(new TransportAddress(InetAddress.getByName(host), Integer.parseInt(port)));
4244
}
4345
client = transportClient;
46+
closeStatus = false;
4447
} catch (UnknownHostException e) {
4548
e.printStackTrace();
4649
}
@@ -586,12 +589,14 @@ public void rollback() throws SQLException {
586589

587590
@Override
588591
public void close() throws SQLException {
592+
this.getClient().close();
593+
closeStatus = true;
589594

590595
}
591596

592597
@Override
593598
public boolean isClosed() throws SQLException {
594-
return false;
599+
return closeStatus;
595600
}
596601

597602
@Override

0 commit comments

Comments
 (0)