mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
改进PreparedStatementCache
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@916 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user