當前位置: 首頁>>代碼示例>>Java>>正文


Java DruidDataSource.setUseGlobalDataSourceStat方法代碼示例

本文整理匯總了Java中com.alibaba.druid.pool.DruidDataSource.setUseGlobalDataSourceStat方法的典型用法代碼示例。如果您正苦於以下問題:Java DruidDataSource.setUseGlobalDataSourceStat方法的具體用法?Java DruidDataSource.setUseGlobalDataSourceStat怎麽用?Java DruidDataSource.setUseGlobalDataSourceStat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.alibaba.druid.pool.DruidDataSource的用法示例。


在下文中一共展示了DruidDataSource.setUseGlobalDataSourceStat方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clusterDataSource

import com.alibaba.druid.pool.DruidDataSource; //導入方法依賴的package包/類
@ConfigurationProperties(prefix = "spring.datasource.cluster")
@Bean(name = "clusterDataSource")
public DataSource clusterDataSource() {
    DruidDataSource dataSource = new DruidDataSource();
    try {
        dataSource.setFilters("stat,wall,log4j");
        dataSource.setUseGlobalDataSourceStat(true);
    } catch (SQLException e) {
        //
    }
    return dataSource;
}
 
開發者ID:Lengchuan,項目名稱:SpringBoot-Study,代碼行數:13,代碼來源:ClusterDruidDataSourceConfig.java

示例2: mysqlDataSource

import com.alibaba.druid.pool.DruidDataSource; //導入方法依賴的package包/類
public DataSource mysqlDataSource() throws Exception{
    DruidDataSource druidDataSource = new DruidDataSource();
    druidDataSource.setUrl(this.url);
    druidDataSource.setUsername(this.username);
    druidDataSource.setPassword(this.password);
    druidDataSource.setDriverClassName(this.driverClassName);
    druidDataSource.setInitialSize(this.initialSize);
    druidDataSource.setMaxActive(this.maxActive);
    druidDataSource.setMinIdle(this.minIdle);
    druidDataSource.setMaxWait(this.maxWait);
    druidDataSource.setTimeBetweenEvictionRunsMillis(this.timeBetweenEvictionRunsMillis);
    druidDataSource.setMinEvictableIdleTimeMillis(this.minEvictableIdleTimeMillis);
    druidDataSource.setValidationQuery(this.validationQuery);
    druidDataSource.setTestWhileIdle(this.testWhileIdle);
    druidDataSource.setTestOnBorrow(this.testOnBorrow);
    druidDataSource.setTestOnReturn(this.testOnReturn);
    druidDataSource.setPoolPreparedStatements(this.poolPreparedStatements);
    druidDataSource.setMaxPoolPreparedStatementPerConnectionSize(this.maxPoolPreparedStatementPerConnectionSize);
    druidDataSource.setFilters(this.filters);
    try {
        druidDataSource.setFilters("wall,stat");
        druidDataSource.setUseGlobalDataSourceStat(true);
        druidDataSource.init();
    } catch (Exception e) {
        throw new RuntimeException("load datasource error, dbProperties is :", e);
    }
    return druidDataSource;
}
 
開發者ID:YupaiTS,項目名稱:docs-manage,代碼行數:29,代碼來源:DruidProperties.java

示例3: dataSource

import com.alibaba.druid.pool.DruidDataSource; //導入方法依賴的package包/類
@Bean     //聲明其為Bean實例  
public DataSource dataSource(){  
    DruidDataSource datasource = new DruidDataSource();  
    datasource.setUrl(dbUrl);  
    datasource.setUsername(username);  
    datasource.setPassword(password);  
    datasource.setDriverClassName(driverClassName);  
	  
    //configuration  
    datasource.setInitialSize(initialSize);  
    datasource.setMinIdle(minIdle);  
    datasource.setMaxActive(maxActive);  
    datasource.setMaxWait(maxWait);  
    datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);  
    datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);  
    datasource.setValidationQuery(validationQuery);  
    datasource.setTestWhileIdle(testWhileIdle);  
    datasource.setTestOnBorrow(testOnBorrow);  
    datasource.setTestOnReturn(testOnReturn);  
    datasource.setPoolPreparedStatements(poolPreparedStatements);  
    datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);  
    datasource.setUseGlobalDataSourceStat(useGlobalDataSourceStat);  
    try {  
        datasource.setFilters(filters);  
    } catch (SQLException e) {  
        System.err.println("druid configuration initialization filter: "+ e);  
    }  
    datasource.setConnectionProperties(connectionProperties);  
    return datasource;  
}
 
開發者ID:ranji1221,項目名稱:lemcloud,代碼行數:31,代碼來源:DruidConfig.java


注:本文中的com.alibaba.druid.pool.DruidDataSource.setUseGlobalDataSourceStat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。