mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
代码重构
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@314 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
+3
-5
@@ -35,18 +35,16 @@ public class MySqlValidConnectionChecker implements ValidConnectionChecker, Seri
|
||||
}
|
||||
|
||||
public boolean isValidConnection(Connection c) {
|
||||
Connection conn = null;
|
||||
try {
|
||||
Connection conn = (Connection) c.unwrap(clazz);
|
||||
if (conn != null) {
|
||||
c = conn;
|
||||
}
|
||||
conn = (Connection) c.unwrap(clazz);
|
||||
} catch (SQLException e) {
|
||||
LOG.warn("Unexpected error in ping", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
// if there is a ping method then use it, otherwise just use a 'SELECT 1' statement
|
||||
if (driverHasPingMethod) {
|
||||
if (conn != null && driverHasPingMethod) {
|
||||
try {
|
||||
ping.invoke(c);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user