当前位置: 首页>>代码示例>>Java>>正文


Java MetricsTrackerFactory类代码示例

本文整理汇总了Java中com.zaxxer.hikari.metrics.MetricsTrackerFactory的典型用法代码示例。如果您正苦于以下问题:Java MetricsTrackerFactory类的具体用法?Java MetricsTrackerFactory怎么用?Java MetricsTrackerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MetricsTrackerFactory类属于com.zaxxer.hikari.metrics包,在下文中一共展示了MetricsTrackerFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setMetricsTrackerFactory

import com.zaxxer.hikari.metrics.MetricsTrackerFactory; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory)
{
   boolean isAlreadySet = getMetricsTrackerFactory() != null;
   super.setMetricsTrackerFactory(metricsTrackerFactory);

   if (pool != null) {
      if (isAlreadySet) {
         throw new IllegalStateException("MetricsTrackerFactory can only be set one time");
      }
      else {
         pool.setMetricsTrackerFactory(super.getMetricsTrackerFactory());
      }
   }
}
 
开发者ID:openbouquet,项目名称:HikariCP,代码行数:17,代码来源:HikariDataSource.java

示例2: setMetricsTrackerFactory

import com.zaxxer.hikari.metrics.MetricsTrackerFactory; //导入依赖的package包/类
public void setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory)
{
   this.isRecordMetrics = metricsTrackerFactory != null;
   if (isRecordMetrics) {
      this.metricsTracker = metricsTrackerFactory.create(config.getPoolName(), getPoolStats());
   }
   else {
      this.metricsTracker = new MetricsTracker();
   }
}
 
开发者ID:openbouquet,项目名称:HikariCP,代码行数:11,代码来源:HikariPool.java

示例3: setMetricsTrackerFactory

import com.zaxxer.hikari.metrics.MetricsTrackerFactory; //导入依赖的package包/类
public void setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory)
{
   if (metricRegistry != null) {
      throw new IllegalStateException("cannot use setMetricsTrackerFactory() and setMetricRegistry() together");
   }

   this.metricsTrackerFactory = metricsTrackerFactory;
}
 
开发者ID:openbouquet,项目名称:HikariCP,代码行数:9,代码来源:HikariConfig.java

示例4: testSetters3

import com.zaxxer.hikari.metrics.MetricsTrackerFactory; //导入依赖的package包/类
@Test
public void testSetters3() throws Exception
{
   HikariDataSource ds = new HikariDataSource();
   ds.setMaximumPoolSize(1);
   ds.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

   MetricRegistry metricRegistry = new MetricRegistry();
   MetricsTrackerFactory metricsTrackerFactory = new CodahaleMetricsTrackerFactory(metricRegistry);

   try {
      Connection connection = ds.getConnection();
      connection.close();

      // After the pool as started, we can only set them once...
      ds.setMetricsTrackerFactory(metricsTrackerFactory);

      // and never again...
      ds.setMetricsTrackerFactory(metricsTrackerFactory);
      Assert.fail("Should not have been allowed to set metricsTrackerFactory after pool started");
   }
   catch (IllegalStateException ise) {
      // pass
      try {
         // and never again... (even when calling another method)
         ds.setMetricRegistry(metricRegistry);
         Assert.fail("Should not have been allowed to set registry after pool started");
      }
      catch (IllegalStateException ise2) {
         // pass
      }
   }
   finally {
      ds.close();
   }
}
 
开发者ID:openbouquet,项目名称:HikariCP,代码行数:37,代码来源:TestMetrics.java

示例5: testSetters5

import com.zaxxer.hikari.metrics.MetricsTrackerFactory; //导入依赖的package包/类
@Test
public void testSetters5() throws Exception
{
   HikariDataSource ds = new HikariDataSource();
   ds.setMaximumPoolSize(1);
   ds.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

   MetricRegistry metricRegistry = new MetricRegistry();
   MetricsTrackerFactory metricsTrackerFactory = new CodahaleMetricsTrackerFactory(metricRegistry);

   // before the pool is started, we can set it any number of times using either setter
   ds.setMetricsTrackerFactory(metricsTrackerFactory);
   ds.setMetricsTrackerFactory(metricsTrackerFactory);
   ds.setMetricsTrackerFactory(metricsTrackerFactory);

   try {
      Connection connection = ds.getConnection();
      connection.close();

      // after the pool is started, we cannot set it any more
      ds.setMetricsTrackerFactory(metricsTrackerFactory);
      Assert.fail("Should not have been allowed to set registry factory after pool started");
   }
   catch (IllegalStateException ise) {
      // pass
   }
   finally {
      ds.close();
   }
}
 
开发者ID:openbouquet,项目名称:HikariCP,代码行数:31,代码来源:TestMetrics.java

示例6: setHikariStats

import com.zaxxer.hikari.metrics.MetricsTrackerFactory; //导入依赖的package包/类
@Nonnull
@CheckReturnValue
public Builder setHikariStats(@Nullable final MetricsTrackerFactory hikariStats) {
    this.hikariStats = hikariStats;
    return this;
}
 
开发者ID:napstr,项目名称:SqlSauce,代码行数:7,代码来源:DatabaseConnection.java

示例7: getMetricsTrackerFactory

import com.zaxxer.hikari.metrics.MetricsTrackerFactory; //导入依赖的package包/类
public MetricsTrackerFactory getMetricsTrackerFactory()
{
   return metricsTrackerFactory;
}
 
开发者ID:openbouquet,项目名称:HikariCP,代码行数:5,代码来源:HikariConfig.java


注:本文中的com.zaxxer.hikari.metrics.MetricsTrackerFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。