Java 类io.vertx.core.spi.metrics.PoolMetrics 实例源码

项目:statful-client-vertx    文件:VertxMetricsImpl.java   
@Override
public <P> PoolMetrics<?> createMetrics(final P pool, final String poolType, final String poolName, final int maxPoolSize) {

    // When creating pool metrics we cannot create the sender because vertx is not completely initialized
    // This is an hack and the reporter will need to be decoupled from the poolMetricsCollectors
    PoolMetricsImpl poolMetrics = new PoolMetricsImpl(statfulMetricsOptions, vertx, poolType, poolName, maxPoolSize);
    this.poolMetricsCollectors.add(poolMetrics);
    return poolMetrics;
}
项目:vertx-hawkular-metrics    文件:VertxMetricsImpl.java   
@Override
public <P> PoolMetrics<?> createMetrics(P pool, String poolType, String poolName, int maxPoolSize) {
  NamedPoolMetricsSupplier supplier = (NamedPoolMetricsSupplier) metricSuppliers.get(NAMED_POOLS);
  PoolMetrics<?> poolMetrics;
  if (supplier != null) {
    poolMetrics = new PoolMetricsImpl(supplier, poolType, poolName, maxPoolSize);
  } else {
    poolMetrics = super.createMetrics(pool, poolType, poolName, maxPoolSize);
  }
  return poolMetrics;
}
项目:vertx-jdbc-client    文件:JDBCConnectionImpl.java   
public JDBCConnectionImpl(Context context, JDBCStatementHelper helper, Connection conn, PoolMetrics metrics, Object metric) {
  this.vertx = context.owner();
  this.helper = helper;
  this.conn = conn;
  this.metrics = metrics;
  this.metric = metric;
  this.ctx = (ContextInternal) context;
}
项目:vertx-jdbc-client    文件:JDBCPoolMetricsTest.java   
private SQLClient getClient() {
  if (client == null) {
    Map<String, PoolMetrics> metricsMap = FakePoolMetrics.getPoolMetrics();
    Set<String> keys = new HashSet<>(metricsMap.keySet());
    client = JDBCClient.createNonShared(vertx, JDBCClientTestBase.config().
        put("max_pool_size", 10));
    Set<String> after = new HashSet<>(metricsMap.keySet());
    after.removeAll(keys);
    metrics = (FakePoolMetrics) metricsMap.get(after.iterator().next());
  }
  return client;
}
项目:vertx-jdbc-client    文件:JDBCPoolMetricsTest.java   
@Test
public void testLifecycle() {
  Map<String, PoolMetrics> metricsMap = FakePoolMetrics.getPoolMetrics();
  assertEquals(Collections.emptySet(), metricsMap.keySet());
  client = getClient();
  assertEquals(1, metricsMap.size());
  assertEquals(10, metrics.getPoolSize());
  client.close();
  client = null;
  assertEquals(0, metricsMap.size());
}
项目:vertx-spring    文件:VertxMetricsAdapter.java   
@Override
default <P> PoolMetrics<?> createMetrics(P pool, String poolType, String poolName, int maxPoolSize) {
    return DummyVertxMetrics.DummyWorkerPoolMetrics.INSTANCE;
}
项目:vertx-spring    文件:DispatchingPoolMetrics.java   
public DispatchingPoolMetrics(List<? extends PoolMetrics> delegates) {
    super(delegates);
}
项目:vertx-spring    文件:DispatchingPoolMetrics.java   
@Override
public Map<PoolMetrics, ?> submitted() {
    return dispatchWithResult(m -> m.submitted());
}
项目:vertx-spring    文件:DispatchingPoolMetrics.java   
@Override
public Map<PoolMetrics, ?> begin(Map<PoolMetrics, ?> context) {
    return unmapWithResult(context, (m, c) -> m.begin(c));
}
项目:vertx-spring    文件:DispatchingPoolMetrics.java   
@Override
public void rejected(Map<PoolMetrics, ?> context) {
    unmap(context, (m, c) -> m.rejected(c));
}
项目:vertx-spring    文件:DispatchingPoolMetrics.java   
@Override
public void end(Map<PoolMetrics, ?> context, boolean succeeded) {
    unmap(context, (m, c) -> m.end(c, succeeded));
}
项目:vertx-spring    文件:DispatchingVertxMetrics.java   
@Override
public <P> PoolMetrics<?> createMetrics(P pool, String poolType, String poolName, int maxPoolSize) {
    return this.<PoolMetrics<?>> createSubMetrics(v -> v.createMetrics(pool, poolType, poolName, maxPoolSize),
            d -> new DispatchingPoolMetrics(d));
}
项目:vertx-spring    文件:VertxActuatorMetrics.java   
@Override
public <P> PoolMetrics<?> createMetrics(P pool, String poolType, String poolName, int maxPoolSize) {
    return new PoolMetricsImpl(counterService, gaugeService, properties.getPool());
}
项目:vertx-dropwizard-metrics    文件:VertxMetricsImpl.java   
@Override
public <P> PoolMetrics<?> createMetrics(P pool, String poolType, String poolName, int maxPoolSize) {
  String baseName = nameOf("pools", poolType, poolName);
  return new PoolMetricsImpl(registry, baseName, maxPoolSize);
}