mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
DruidDataSource support failFast
This commit is contained in:
@@ -1453,7 +1453,7 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
validateConnection(conn);
|
||||
validatedNanos = System.nanoTime();
|
||||
|
||||
createError = null;
|
||||
setCreateError(null);
|
||||
} catch (SQLException ex) {
|
||||
setCreateError(ex);
|
||||
throw ex;
|
||||
@@ -1472,6 +1472,16 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
}
|
||||
|
||||
protected void setCreateError(Throwable ex) {
|
||||
if (ex == null) {
|
||||
lock.lock();
|
||||
try {
|
||||
createError = null;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
createErrorCount.incrementAndGet();
|
||||
long now = System.currentTimeMillis();
|
||||
lock.lock();
|
||||
|
||||
Reference in New Issue
Block a user