mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
revert
This commit is contained in:
@@ -840,62 +840,25 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String user) {
|
||||
lock.lock();
|
||||
try {
|
||||
if (equals(this.username, user)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (inited) {
|
||||
this.modCount++;
|
||||
clear();
|
||||
}
|
||||
|
||||
this.username = user;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
public void setUsername(String username) {
|
||||
if (inited) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public void setUrlAndUserAndPassword(String url, String user, String password) {
|
||||
lock.lock();
|
||||
try {
|
||||
if (equals(this.jdbcUrl, url) && equals(this.username, user) && equals(this.password, password)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (inited) {
|
||||
this.modCount++;
|
||||
clear();
|
||||
}
|
||||
|
||||
this.username = user;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
lock.lock();
|
||||
try {
|
||||
if (equals(this.password, password)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (inited) {
|
||||
this.modCount++;
|
||||
clear();
|
||||
}
|
||||
|
||||
this.password = password;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
if (inited) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Properties getConnectProperties() {
|
||||
@@ -948,25 +911,13 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
}
|
||||
|
||||
public void setUrl(String jdbcUrl) {
|
||||
lock.lock();
|
||||
try {
|
||||
if (equals(this.jdbcUrl, jdbcUrl)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (inited) {
|
||||
this.modCount++;
|
||||
clear();
|
||||
}
|
||||
|
||||
this.jdbcUrl = jdbcUrl;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
if (inited) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
this.jdbcUrl = jdbcUrl;
|
||||
}
|
||||
|
||||
public abstract void clear();
|
||||
|
||||
public String getDriverClassName() {
|
||||
return driverClass;
|
||||
}
|
||||
|
||||
@@ -1185,28 +1185,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
final List<ConnectionHolder> evictList = new ArrayList<ConnectionHolder>();
|
||||
|
||||
lock.lock();
|
||||
try {
|
||||
for (int i = 0; i < poolingCount; ++i) {
|
||||
ConnectionHolder connection = connections[i];
|
||||
evictList.add(connection);
|
||||
}
|
||||
|
||||
poolingCount = 0;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
for (ConnectionHolder item : evictList) {
|
||||
Connection connection = item.getConnection();
|
||||
JdbcUtils.close(connection);
|
||||
destroyCount++;
|
||||
}
|
||||
}
|
||||
|
||||
public int getWaitThreadCount() {
|
||||
lock.lock();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user