mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add logDiffrentThread 开关
This commit is contained in:
@@ -149,6 +149,8 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
|
||||
public static ThreadLocal<Long> waitNanosLocal = new ThreadLocal<Long>();
|
||||
|
||||
private boolean logDiffrentThread = true;
|
||||
|
||||
public DruidDataSource(){
|
||||
this(false);
|
||||
}
|
||||
@@ -1128,7 +1130,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
return;
|
||||
}
|
||||
|
||||
if (pooledConnection.getOwnerThread() != Thread.currentThread()) {
|
||||
if (logDiffrentThread && pooledConnection.getOwnerThread() != Thread.currentThread()) {
|
||||
LOG.warn("get/close not same thread");
|
||||
}
|
||||
|
||||
@@ -2393,4 +2395,12 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
|
||||
return super.unwrap(iface);
|
||||
}
|
||||
|
||||
public boolean isLogDiffrentThread() {
|
||||
return logDiffrentThread;
|
||||
}
|
||||
|
||||
public void setLogDiffrentThread(boolean logDiffrentThread) {
|
||||
this.logDiffrentThread = logDiffrentThread;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user