io.vertx.core.spi.metrics.PoolMetrics Java Examples

The following examples show how to use io.vertx.core.spi.metrics.PoolMetrics. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JDBCPoolMetricsTest.java    From vertx-jdbc-client with Apache License 2.0 6 votes vote down vote up
@Test
public void testLifecycle() {
  Map<String, PoolMetrics> metricsMap = FakePoolMetrics.getPoolMetrics();
  assertEquals(Collections.emptySet(), metricsMap.keySet());
  client = getClient();
  assertEquals(0, metricsMap.size());
  client.getConnection(onSuccess(conn -> {
    assertEquals(1, metricsMap.size());
    assertEquals(10, getMetrics().getPoolSize());
    conn.close(onSuccess(connClosed -> {
      client.close(onSuccess(clientClose -> {
        client = null;
        assertEquals(0, metricsMap.size());
        testComplete();
      }));
    }));
  }));
  await();
}
 
Example #2
Source File: JDBCConnectionImpl.java    From vertx-jdbc-client with Apache License 2.0 5 votes vote down vote up
public JDBCConnectionImpl(Context context, JDBCStatementHelper helper, Connection conn, PoolMetrics metrics, Object metric) {
  this.helper = helper;
  this.conn = conn;
  this.metrics = metrics;
  this.metric = metric;
  this.ctx = (ContextInternal) context;
}
 
Example #3
Source File: DataSourceHolder.java    From vertx-jdbc-client with Apache License 2.0 5 votes vote down vote up
private DataSourceHolder(TaskQueue creationQueue, DataSourceProvider provider, DataSource dataSource, ExecutorService exec, PoolMetrics metrics, int refCount) {
  if (dataSource != null) {
    Objects.requireNonNull(exec);
  } else {
    Objects.requireNonNull(creationQueue);
    Objects.requireNonNull(provider);
  }
  this.creationQueue = creationQueue;
  this.provider = provider;
  this.dataSource = dataSource;
  this.exec = exec;
  this.metrics = metrics;
  this.refCount = refCount;
}
 
Example #4
Source File: DataSourceHolder.java    From vertx-jdbc-client with Apache License 2.0 5 votes vote down vote up
DataSourceHolder created(DataSource dataSource, ExecutorService exec, PoolMetrics metrics) {
  Objects.requireNonNull(dataSource);
  Objects.requireNonNull(exec);
  if (this.dataSource != null) {
    throw new IllegalStateException();
  }
  return new DataSourceHolder(creationQueue, provider, dataSource, exec, metrics, refCount);
}
 
Example #5
Source File: VertxMetricsAdapter.java    From besu with Apache License 2.0 4 votes vote down vote up
@Override
public PoolMetrics<?> createPoolMetrics(
    final String poolType, final String poolName, final int maxPoolSize) {
  return new PoolMetricsAdapter(metricsSystem, poolType, poolName);
}
 
Example #6
Source File: VertxPoolMetrics.java    From vertx-micrometer-metrics with Apache License 2.0 4 votes vote down vote up
PoolMetrics forInstance(String poolType, String poolName, int maxPoolSize) {
  return new Instance(poolType, poolName, maxPoolSize);
}
 
Example #7
Source File: SyncContext.java    From servicecomb-java-chassis with Apache License 2.0 4 votes vote down vote up
@Override
<T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler,
    Handler<AsyncResult<T>> resultHandler,
    Executor exec, TaskQueue queue, @SuppressWarnings("rawtypes") PoolMetrics metrics) {
  syncExecuteBlocking(blockingCodeHandler, resultHandler);
}
 
Example #8
Source File: JDBCClientImpl.java    From vertx-jdbc-client with Apache License 2.0 4 votes vote down vote up
private PoolMetrics createMetrics(String poolName, int maxPoolSize) {
  VertxMetrics metricsSPI = vertx.metricsSPI();
  return metricsSPI != null ? metricsSPI.createPoolMetrics("datasource", poolName, maxPoolSize) : null;
}
 
Example #9
Source File: JDBCClose.java    From vertx-jdbc-client with Apache License 2.0 4 votes vote down vote up
public JDBCClose(SQLOptions options, PoolMetrics metrics, Object metric) {
  super(options);
  this.metrics = metrics;
  this.metric = metric;
}
 
Example #10
Source File: DataSourceHolder.java    From vertx-jdbc-client with Apache License 2.0 4 votes vote down vote up
DataSourceHolder(DataSource dataSource, ExecutorService exec, PoolMetrics metrics) {
  this(null, null, dataSource, exec, metrics, 1);
}