本文整理汇总了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());
}
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例6: setHikariStats
import com.zaxxer.hikari.metrics.MetricsTrackerFactory; //导入依赖的package包/类
@Nonnull
@CheckReturnValue
public Builder setHikariStats(@Nullable final MetricsTrackerFactory hikariStats) {
this.hikariStats = hikariStats;
return this;
}
示例7: getMetricsTrackerFactory
import com.zaxxer.hikari.metrics.MetricsTrackerFactory; //导入依赖的package包/类
public MetricsTrackerFactory getMetricsTrackerFactory()
{
return metricsTrackerFactory;
}