mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
修正connection.id,statement.id, resultSet.id生成不正确的问题
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@227 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -23,6 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import javax.management.JMException;
|
||||
import javax.management.openmbean.ArrayType;
|
||||
@@ -55,6 +56,10 @@ public class DataSourceProxyImpl implements DataSourceProxy, DataSourceProxyImpl
|
||||
|
||||
private String dbType;
|
||||
|
||||
private final AtomicLong connectionIdSeed = new AtomicLong(10000);
|
||||
private final AtomicLong statementIdSeed = new AtomicLong(20000);
|
||||
private final AtomicLong resultSetIdSeed = new AtomicLong(50000);
|
||||
|
||||
public DataSourceProxyImpl(Driver rawDriver, DataSourceProxyConfig config){
|
||||
super();
|
||||
this.rawDriver = rawDriver;
|
||||
@@ -214,4 +219,15 @@ public class DataSourceProxyImpl implements DataSourceProxy, DataSourceProxyImpl
|
||||
return config.getRawUrl();
|
||||
}
|
||||
|
||||
public long createConnectionId() {
|
||||
return connectionIdSeed.incrementAndGet();
|
||||
}
|
||||
|
||||
public long createStatementId() {
|
||||
return statementIdSeed.getAndIncrement();
|
||||
}
|
||||
|
||||
public long createResultSetId() {
|
||||
return resultSetIdSeed.getAndIncrement();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user