数据库连接池

package pool;
/**
* 这是外部可以配置的连接池属性
* 可以允许外部配置,拥有默认值
* @author Ran
*
*/
public class DBbean {
// 连接池属性
private String driverName;
private String url;
private String userName;
private String password;
// 连接池名字
private String poolName;
private int minConnections = 1; // 空闲池,最小连接数
private int maxConnections = 10; // 空闲池,最大连接数

private int initConnections = 5;// 初始化连接数

private long connTimeOut = 1000;// 重复获得连接的频率

private int maxActiveConnections = 100;// 最大允许的连接数,和数据库对应

private long connectionTimeOut = 1000*60*20;// 连接超时时间,默认20分钟

private boolean isCurrentConnection = true; // 是否获得当前连接,默认true

private boolean isCheakPool = true; // 是否定时检查连接池
private long lazyCheck = 1000*60*60;// 延迟多少时间后开始 检查
private long periodCheck = 1000*60*60;// 检查频率



public DBbean(String driverName, String url, String userName,
        String password, String poolName) {
    super();
    this.driverName = driverName;
    this.url = url;
    this.userName = userName;
    this.password = password;
    this.poolName = poolName;
}
public DBbean() {
}
public String getDriverName() {
    if(driverName == null){
        driverName = this.getDriverName()+"_"+this.getUrl();
    }
    return driverName;
}
public void setDriverName(String driverName) {
    this.driverName = driverName;
}
public String getUrl() {
    return url;
}
public void setUrl(String url) {
    this.url = url;
}
public String getUserName() {
    return userName;
}
public void setUserName(String userName) {
    this.userName = userName;
}
public String getPassword() {
    return password;
}
public void setPassword(String password) {
    this.password = password;
}
public String getPoolName() {
    return poolName;
}
public void setPoolName(String poolName) {
    this.poolName = poolName;
}
public int getMinConnections() {
    return minConnections;
}
public void setMinConnections(int minConnections) {
    this.minConnections = minConnections;
}
public int getMaxConnections() {
    return maxConnections;
}
public void setMaxConnections(int maxConnections) {
    this.maxConnections = maxConnections;
}
public int getInitConnections() {
    return initConnections;
}
public void setInitConnections(int initConnections) {
    this.initConnections = initConnections;
}

public int getMaxActiveConnections() {
    return maxActiveConnections;
}
public void setMaxActiveConnections(int maxActiveConnections) {
    this.maxActiveConnections = maxActiveConnections;
}
public long getConnTimeOut() {
    return connTimeOut;
}
public void setConnTimeOut(long connTimeOut) {
    this.connTimeOut = connTimeOut;
}
public long getConnectionTimeOut() {
    return connectionTimeOut;
}
public void setConnectionTimeOut(long connectionTimeOut) {
    this.connectionTimeOut = connectionTimeOut;
}
public boolean isCurrentConnection() {
    return isCurrentConnection;
}
public void setCurrentConnection(boolean isCurrentConnection) {
    this.isCurrentConnection = isCurrentConnection;
}
public long getLazyCheck() {
    return lazyCheck;
}
public void setLazyCheck(long lazyCheck) {
    this.lazyCheck = lazyCheck;
}
public long getPeriodCheck() {
    return periodCheck;
}
public void setPeriodCheck(long periodCheck) {
    this.periodCheck = periodCheck;
}
public boolean isCheakPool() {
    return isCheakPool;
}
public void setCheakPool(boolean isCheakPool) {
    this.isCheakPool = isCheakPool;
}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值