當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。