改进PreparedStatementCache

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@916 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-09-29 00:49:34 +00:00
parent 38fcc483f6
commit 0aafc4ab96
10 changed files with 170 additions and 114 deletions
@@ -17,20 +17,36 @@ package com.alibaba.druid.pool;
import java.sql.PreparedStatement;
import com.alibaba.druid.pool.PoolablePreparedStatement.PreparedStatementKey;
/**
* @author wenshao<szujobs@hotmail.com>
*/
public final class PreparedStatementHolder<T extends PreparedStatement> {
public final class PreparedStatementHolder {
private final T statement;
private final PreparedStatementKey key;
private final PreparedStatement statement;
private int useCount = 0;
public PreparedStatementHolder(T stmt){
super();
public PreparedStatementHolder(PreparedStatementKey key, PreparedStatement stmt){
this.key = key;
this.statement = stmt;
}
public T getStatement() {
public PreparedStatement getStatement() {
return statement;
}
public PreparedStatementKey getKey() {
return key;
}
public void incrementReusedCount() {
useCount++;
}
public int getReusedCount() {
return useCount;
}
}