public class DruidPlugin extends Object implements IPlugin, IDataSourceProvider
Constructor and Description |
---|
DruidPlugin(String url,
String username,
String password) |
DruidPlugin(String url,
String username,
String password,
String driverClass) |
DruidPlugin(String url,
String username,
String password,
String driverClass,
String filters) |
Modifier and Type | Method and Description |
---|---|
DruidPlugin |
addFilter(com.alibaba.druid.filter.Filter filter) |
DataSource |
getDataSource() |
String |
getName() |
DruidPlugin |
set(int initialSize,
int minIdle,
int maxActive) |
void |
setConnectionInitSql(String sql)
添加连接时的初始化sql。可以添加多次,在初次连接时使用,比如指定编码或者默认scheme等
|
DruidPlugin |
setConnectionProperties(String connectionProperties) |
DruidPlugin |
setDriverClass(String driverClass) |
DruidPlugin |
setFilters(String filters)
设置过滤器,如果要开启监控统计需要使用此方法或在构造方法中进行设置
|
DruidPlugin |
setInitialSize(int initialSize) |
DruidPlugin |
setLogAbandoned(boolean logAbandoned) |
DruidPlugin |
setMaxActive(int maxActive) |
DruidPlugin |
setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) |
DruidPlugin |
setMaxWait(long maxWait) |
DruidPlugin |
setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) |
DruidPlugin |
setMinIdle(int minIdle) |
void |
setName(String name)
连接池名称
|
DruidPlugin |
setPublicKey(String publicKey) |
DruidPlugin |
setRemoveAbandoned(boolean removeAbandoned) |
DruidPlugin |
setRemoveAbandonedTimeoutMillis(long removeAbandonedTimeoutMillis) |
DruidPlugin |
setTestOnBorrow(boolean testOnBorrow) |
DruidPlugin |
setTestOnReturn(boolean testOnReturn) |
DruidPlugin |
setTestWhileIdle(boolean testWhileIdle) |
DruidPlugin |
setTimeBetweenConnectErrorMillis(long timeBetweenConnectErrorMillis) |
DruidPlugin |
setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) |
DruidPlugin |
setValidationQuery(String validationQuery)
hsqldb - "select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"
Oracle - "select 1 from dual"
DB2 - "select 1 from sysibm.sysdummy1"
mysql - "select 1"
|
boolean |
start() |
boolean |
stop() |
public void setConnectionInitSql(String sql)
sql
- public final String getName()
public final void setName(String name)
name
- public DruidPlugin setFilters(String filters)
监控统计:"stat" 防SQL注入:"wall" 组合使用: "stat,wall"
public DruidPlugin addFilter(com.alibaba.druid.filter.Filter filter)
public DataSource getDataSource()
getDataSource
in interface IDataSourceProvider
public DruidPlugin set(int initialSize, int minIdle, int maxActive)
public DruidPlugin setDriverClass(String driverClass)
public DruidPlugin setInitialSize(int initialSize)
public DruidPlugin setMinIdle(int minIdle)
public DruidPlugin setMaxActive(int maxActive)
public DruidPlugin setMaxWait(long maxWait)
public DruidPlugin setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
public DruidPlugin setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
public DruidPlugin setValidationQuery(String validationQuery)
public DruidPlugin setTestWhileIdle(boolean testWhileIdle)
public DruidPlugin setTestOnBorrow(boolean testOnBorrow)
public DruidPlugin setTestOnReturn(boolean testOnReturn)
public DruidPlugin setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize)
public final DruidPlugin setTimeBetweenConnectErrorMillis(long timeBetweenConnectErrorMillis)
public final DruidPlugin setRemoveAbandoned(boolean removeAbandoned)
public final DruidPlugin setRemoveAbandonedTimeoutMillis(long removeAbandonedTimeoutMillis)
public final DruidPlugin setLogAbandoned(boolean logAbandoned)
public final DruidPlugin setConnectionProperties(String connectionProperties)
public final DruidPlugin setPublicKey(String publicKey)
Copyright © 2018. All rights reserved.