delete pool
parent
15c81886ac
commit
01923ae1f4
@ -1,68 +0,0 @@
|
||||
package com.anjiplus.template.gaea.business.modules.dataSource.pool.datasource;
|
||||
|
||||
/**
|
||||
* @author binbin.hou
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class AbstractDataSourceConfig extends DataSourceConfigAdaptor {
|
||||
|
||||
/**
|
||||
* 驱动类
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected String driverClass;
|
||||
|
||||
/**
|
||||
* jdbc url
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected String jdbcUrl;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected String user;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected String password;
|
||||
|
||||
public String getDriverClass() {
|
||||
return driverClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDriverClass(String driverClass) {
|
||||
this.driverClass = driverClass;
|
||||
}
|
||||
|
||||
public String getJdbcUrl() {
|
||||
return jdbcUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJdbcUrl(String jdbcUrl) {
|
||||
this.jdbcUrl = jdbcUrl;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
@ -1,159 +0,0 @@
|
||||
package com.anjiplus.template.gaea.business.modules.dataSource.pool.datasource;
|
||||
|
||||
import com.anjiplus.template.gaea.business.modules.dataSource.pool.api.ILifeCycle;
|
||||
import com.anjiplus.template.gaea.business.modules.dataSource.pool.api.IPooledDataSourceConfig;
|
||||
import com.anjiplus.template.gaea.business.modules.dataSource.pool.constant.PooledConst;
|
||||
|
||||
/**
|
||||
* @author binbin.hou
|
||||
* @since 1.1.0
|
||||
*/
|
||||
public abstract class AbstractPooledDataSourceConfig extends AbstractDataSourceConfig
|
||||
implements IPooledDataSourceConfig, ILifeCycle {
|
||||
|
||||
/**
|
||||
* 最小尺寸
|
||||
* @since 1.1.0
|
||||
*/
|
||||
protected int minSize = PooledConst.DEFAULT_MIN_SIZE;
|
||||
|
||||
/**
|
||||
* 最大尺寸
|
||||
* @since 1.1.0
|
||||
*/
|
||||
protected int maxSize = PooledConst.DEFAULT_MAX_SIZE;
|
||||
|
||||
/**
|
||||
* 最大的等待时间
|
||||
* @since 1.3.0
|
||||
*/
|
||||
protected long maxWaitMills = PooledConst.DEFAULT_MAX_WAIT_MILLS;
|
||||
|
||||
/**
|
||||
* 验证查询
|
||||
* @since 1.5.0
|
||||
*/
|
||||
protected String validQuery = PooledConst.DEFAULT_VALID_QUERY;
|
||||
|
||||
/**
|
||||
* 验证的超时时间
|
||||
* @since 1.5.0
|
||||
*/
|
||||
protected int validTimeOutSeconds = PooledConst.DEFAULT_VALID_TIME_OUT_SECONDS;
|
||||
|
||||
/**
|
||||
* 获取时验证
|
||||
* @since 1.5.0
|
||||
*/
|
||||
protected boolean testOnBorrow = PooledConst.DEFAULT_TEST_ON_BORROW;
|
||||
|
||||
/**
|
||||
* 归还时验证
|
||||
* @since 1.5.0
|
||||
*/
|
||||
protected boolean testOnReturn = PooledConst.DEFAULT_TEST_ON_RETURN;
|
||||
|
||||
/**
|
||||
* 闲暇时验证
|
||||
* @since 1.5.0
|
||||
*/
|
||||
protected boolean testOnIdle = PooledConst.DEFAULT_TEST_ON_IDLE;
|
||||
|
||||
/**
|
||||
* 闲暇时验证的时间间隔
|
||||
* @since 1.5.0
|
||||
*/
|
||||
protected long testOnIdleIntervalSeconds = PooledConst.DEFAULT_TEST_ON_IDLE_INTERVAL_SECONDS;
|
||||
|
||||
public int getMinSize() {
|
||||
return minSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMinSize(int minSize) {
|
||||
this.minSize = minSize;
|
||||
}
|
||||
|
||||
public int getMaxSize() {
|
||||
return maxSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxSize(int maxSize) {
|
||||
this.maxSize = maxSize;
|
||||
}
|
||||
|
||||
public long getMaxWaitMills() {
|
||||
return maxWaitMills;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxWaitMills(long maxWaitMills) {
|
||||
this.maxWaitMills = maxWaitMills;
|
||||
}
|
||||
|
||||
public String getValidQuery() {
|
||||
return validQuery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValidQuery(String validQuery) {
|
||||
this.validQuery = validQuery;
|
||||
}
|
||||
|
||||
public int getValidTimeOutSeconds() {
|
||||
return validTimeOutSeconds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValidTimeOutSeconds(int validTimeOutSeconds) {
|
||||
this.validTimeOutSeconds = validTimeOutSeconds;
|
||||
}
|
||||
|
||||
public boolean isTestOnBorrow() {
|
||||
return testOnBorrow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTestOnBorrow(boolean testOnBorrow) {
|
||||
this.testOnBorrow = testOnBorrow;
|
||||
}
|
||||
|
||||
public boolean isTestOnReturn() {
|
||||
return testOnReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTestOnReturn(boolean testOnReturn) {
|
||||
this.testOnReturn = testOnReturn;
|
||||
}
|
||||
|
||||
public boolean isTestOnIdle() {
|
||||
return testOnIdle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTestOnIdle(boolean testOnIdle) {
|
||||
this.testOnIdle = testOnIdle;
|
||||
}
|
||||
|
||||
public long getTestOnIdleIntervalSeconds() {
|
||||
return testOnIdleIntervalSeconds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTestOnIdleIntervalSeconds(long testOnIdleIntervalSeconds) {
|
||||
this.testOnIdleIntervalSeconds = testOnIdleIntervalSeconds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
package com.anjiplus.template.gaea.business.modules.dataSource.pool.datasource;
|
||||
|
||||
import com.anjiplus.template.gaea.business.modules.dataSource.pool.api.IDataSourceConfig;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLFeatureNotSupportedException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author binbin.hou
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class DataSourceConfigAdaptor implements IDataSourceConfig {
|
||||
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection(String username, String password) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrapperFor(Class<?> iface) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrintWriter getLogWriter() throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogWriter(PrintWriter out) throws SQLException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLoginTimeout(int seconds) throws SQLException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLoginTimeout() throws SQLException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDriverClass(String driverClass) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJdbcUrl(String jdbcUrl) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUser(String user) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPassword(String password) {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.anjiplus.template.gaea.business.modules.dataSource.pool.datasource;
|
||||
|
||||
import com.anjiplus.template.gaea.business.modules.dataSource.pool.util.DriverClassUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* @author binbin.hou
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class UnPooledDataSource extends AbstractDataSourceConfig {
|
||||
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
DriverClassUtil.loadDriverClass(super.driverClass, super.jdbcUrl);
|
||||
if (StringUtils.isBlank(super.getUser()) && StringUtils.isBlank(super.getPassword())) {
|
||||
return DriverManager.getConnection(super.jdbcUrl);
|
||||
}
|
||||
return DriverManager.getConnection(super.getJdbcUrl(),
|
||||
super.getUser(), super.getPassword());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue