Skip to content

Commit

Permalink
Merge pull request alibaba#736 from wenshao/master
Browse files Browse the repository at this point in the history
并发优化
  • Loading branch information
wenshao committed Dec 5, 2014
2 parents ab6e349 + 55d238e commit d05f635
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
15 changes: 8 additions & 7 deletions src/main/java/com/alibaba/druid/pool/DruidDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -1035,12 +1035,7 @@ public DruidPooledConnection getConnectionDirect(long maxWaitMillis) throws SQLE
public void discardConnection(Connection realConnection) {
JdbcUtils.close(realConnection);

try {
lock.lockInterruptibly();
} catch (InterruptedException e) {
LOG.error("interrupt");
return;
}
lock.lock();
try {
activeCount--;
discardCount++;
Expand Down Expand Up @@ -1263,7 +1258,7 @@ protected void recycle(DruidPooledConnection pooledConnection) throws SQLExcepti

destroyCount.incrementAndGet();

lock.lockInterruptibly();
lock.lock();
try {
activeCount--;
closeCount++;
Expand Down Expand Up @@ -1996,6 +1991,12 @@ public int removeAbandoned() {

if (abandonedList.size() > 0) {
for (DruidPooledConnection pooledConnection : abandonedList) {
synchronized (pooledConnection) {
if (pooledConnection.isDisable()) {
continue;
}
}

JdbcUtils.close(pooledConnection);
pooledConnection.abandond();
removeAbandonedCount++;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/alibaba/druid/util/OracleUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,9 @@ public static void setStatementCacheSize(Connection conn, int size) throws SQLEx
oracleConn.setStatementCacheSize(size);
}

@SuppressWarnings("deprecation")
public static int pingDatabase(Connection conn) throws SQLException {
OracleConnection oracleConn = unwrap(conn);
return oracleConn.pingDatabase(1000);
return oracleConn.pingDatabase();
}

public static void openProxySession(Connection conn, int type, java.util.Properties prop) throws SQLException {
Expand Down

0 comments on commit d05f635

Please sign in to comment.