From 7f26a374322e172fafb4d99f82f1e699c268b4d8 Mon Sep 17 00:00:00 2001 From: wenshao Date: Tue, 18 Sep 2018 12:30:39 +0800 Subject: [PATCH] fixed compile. --- .../com/alibaba/druid/pool/DruidDataSource.java | 13 +++++++++++-- .../druid/sql/visitor/SQLASTOutputVisitor.java | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/alibaba/druid/pool/DruidDataSource.java b/src/main/java/com/alibaba/druid/pool/DruidDataSource.java index cddf680d32..116b776277 100644 --- a/src/main/java/com/alibaba/druid/pool/DruidDataSource.java +++ b/src/main/java/com/alibaba/druid/pool/DruidDataSource.java @@ -1706,13 +1706,22 @@ protected void recycle(DruidPooledConnection pooledConnection) throws SQLExcepti } boolean result; - final long lastActiveTimeMillis = System.currentTimeMillis(); + final long currentTimeMillis = System.currentTimeMillis(); + + if (phyTimeoutMillis > 0) { + long phyConnectTimeMillis = currentTimeMillis - holder.connectTimeMillis; + if (phyConnectTimeMillis > phyTimeoutMillis) { + discardConnection(holder.conn); + return; + } + } + lock.lock(); try { activeCount--; closeCount++; - result = putLast(holder, lastActiveTimeMillis); + result = putLast(holder, currentTimeMillis); recycleCount++; } finally { lock.unlock(); diff --git a/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java b/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java index 38979caf63..77ced32a4e 100644 --- a/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java +++ b/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.druid.sql.visitor +package com.alibaba.druid.sql.visitor; import java.io.IOException; import java.io.InputStream; import java.io.Reader;