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

The following examples show how to use io.vertx.core.spi.metrics.PoolMetrics. These examples are extracted from open source projects. 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 Project: vertx-jdbc-client   Source File: JDBCPoolMetricsTest.java    License: 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 Project: vertx-jdbc-client   Source File: JDBCConnectionImpl.java    License: 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 Project: vertx-jdbc-client   Source File: DataSourceHolder.java    License: 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 Project: vertx-jdbc-client   Source File: DataSourceHolder.java    License: 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 Project: besu   Source File: VertxMetricsAdapter.java    License: 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 Project: vertx-micrometer-metrics   Source File: VertxPoolMetrics.java    License: 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 Project: servicecomb-java-chassis   Source File: SyncContext.java    License: 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 Project: vertx-jdbc-client   Source File: JDBCClientImpl.java    License: 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 Project: vertx-jdbc-client   Source File: JDBCClose.java    License: 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 Project: vertx-jdbc-client   Source File: DataSourceHolder.java    License: Apache License 2.0 4 votes vote down vote up
DataSourceHolder(DataSource dataSource, ExecutorService exec, PoolMetrics metrics) {
  this(null, null, dataSource, exec, metrics, 1);
}