本文整理匯總了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;
}