mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for clone
This commit is contained in:
@@ -36,6 +36,7 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -48,6 +49,7 @@ import javax.security.auth.callback.NameCallback;
|
||||
import javax.security.auth.callback.PasswordCallback;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import com.alibaba.druid.DruidRuntimeException;
|
||||
import com.alibaba.druid.filter.Filter;
|
||||
import com.alibaba.druid.filter.FilterChainImpl;
|
||||
import com.alibaba.druid.filter.FilterManager;
|
||||
@@ -238,6 +240,8 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
protected DruidDataSourceStatLogger statLogger = new DruidDataSourceStatLoggerImpl();
|
||||
|
||||
private boolean asyncCloseConnectionEnable = false;
|
||||
protected ScheduledExecutorService destroyScheduler;
|
||||
protected ScheduledExecutorService createScheduler;
|
||||
|
||||
public DruidAbstractDataSource(boolean lockFair){
|
||||
lock = new ReentrantLock(lockFair);
|
||||
@@ -1679,6 +1683,8 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
to.isOracle = this.isOracle;
|
||||
to.useOracleImplicitCache = this.useOracleImplicitCache;
|
||||
to.asyncCloseConnectionEnable = this.asyncCloseConnectionEnable;
|
||||
to.createScheduler = this.createScheduler;
|
||||
to.destroyScheduler = this.destroyScheduler;
|
||||
}
|
||||
|
||||
public abstract void discardConnection(Connection realConnection);
|
||||
@@ -1695,4 +1701,30 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
this.asyncCloseConnectionEnable = asyncCloseConnectionEnable;
|
||||
}
|
||||
|
||||
public ScheduledExecutorService getCreateScheduler() {
|
||||
return createScheduler;
|
||||
}
|
||||
|
||||
public void setCreateScheduler(ScheduledExecutorService createScheduler) {
|
||||
if (isInited()) {
|
||||
throw new DruidRuntimeException("dataSource inited.");
|
||||
}
|
||||
this.createScheduler = createScheduler;
|
||||
}
|
||||
|
||||
public ScheduledExecutorService getDestroyScheduler() {
|
||||
return destroyScheduler;
|
||||
}
|
||||
|
||||
|
||||
public void setDestroyScheduler(ScheduledExecutorService destroyScheduler) {
|
||||
if (isInited()) {
|
||||
throw new DruidRuntimeException("dataSource inited.");
|
||||
}
|
||||
this.destroyScheduler = destroyScheduler;
|
||||
}
|
||||
|
||||
public boolean isInited() {
|
||||
return this.inited;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@@ -53,7 +52,6 @@ import javax.sql.ConnectionPoolDataSource;
|
||||
import javax.sql.PooledConnection;
|
||||
|
||||
import com.alibaba.druid.Constants;
|
||||
import com.alibaba.druid.DruidRuntimeException;
|
||||
import com.alibaba.druid.TransactionTimeoutException;
|
||||
import com.alibaba.druid.VERSION;
|
||||
import com.alibaba.druid.filter.AutoLoad;
|
||||
@@ -128,11 +126,9 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
private int notEmptyWaitThreadPeak = 0;
|
||||
|
||||
// threads
|
||||
private ScheduledExecutorService destroyScheduler;
|
||||
private ScheduledFuture<?> destroySchedulerFuture;
|
||||
private DestroyTask destoryTask;
|
||||
|
||||
private ScheduledExecutorService createScheduler;
|
||||
private CreateConnectionThread createConnectionThread;
|
||||
private DestroyConnectionThread destroyConnectionThread;
|
||||
private LogStatsThread logStatsThread;
|
||||
@@ -496,10 +492,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
this.connectProperties = properties;
|
||||
}
|
||||
|
||||
public boolean isInited() {
|
||||
return this.inited;
|
||||
}
|
||||
|
||||
public void init() throws SQLException {
|
||||
if (inited) {
|
||||
return;
|
||||
@@ -2643,27 +2635,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ScheduledExecutorService getCreateScheduler() {
|
||||
return createScheduler;
|
||||
}
|
||||
|
||||
public void setCreateScheduler(ScheduledExecutorService createScheduler) {
|
||||
this.createScheduler = createScheduler;
|
||||
}
|
||||
|
||||
public ScheduledExecutorService getDestroyScheduler() {
|
||||
return destroyScheduler;
|
||||
}
|
||||
|
||||
|
||||
public void setDestroyScheduler(ScheduledExecutorService destroyScheduler) {
|
||||
if (isInited()) {
|
||||
throw new DruidRuntimeException("dataSource inited.");
|
||||
}
|
||||
this.destroyScheduler = destroyScheduler;
|
||||
}
|
||||
|
||||
private void emptySignal() {
|
||||
if (createScheduler == null) {
|
||||
empty.signal();
|
||||
|
||||
Reference in New Issue
Block a user