From d882aa79a7f1ce8b464b2ad687ff5f0be6604f4c Mon Sep 17 00:00:00 2001 From: Yanming Zhou Date: Wed, 16 Oct 2019 14:14:06 +0800 Subject: [PATCH] Register Driver with DriverAction to cleanup --- src/main/user-impl/java/com/mysql/cj/jdbc/Driver.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/user-impl/java/com/mysql/cj/jdbc/Driver.java b/src/main/user-impl/java/com/mysql/cj/jdbc/Driver.java index 9099033a..36028e42 100644 --- a/src/main/user-impl/java/com/mysql/cj/jdbc/Driver.java +++ b/src/main/user-impl/java/com/mysql/cj/jdbc/Driver.java @@ -52,7 +52,9 @@ // static { try { - java.sql.DriverManager.registerDriver(new Driver()); + java.sql.DriverManager.registerDriver(new Driver(), () -> { + AbandonedConnectionCleanupThread.checkedShutdown(); + }); } catch (SQLException E) { throw new RuntimeException("Can't register driver!"); }