io.vertx.ext.unit.Async.countDown()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(30)

本文整理了Java中io.vertx.ext.unit.Async.countDown()方法的一些代码示例,展示了Async.countDown()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Async.countDown()方法的具体详情如下:
包路径:io.vertx.ext.unit.Async
类名称:Async
方法名:countDown

Async.countDown介绍

暂无

代码示例

代码示例来源:origin: io.vertx/vertx-rx-java

/**
 * Count down the async.
 */
public void countDown() { 
 delegate.countDown();
}

代码示例来源:origin: vert-x3/vertx-rx

/**
 * Count down the async.
 */
public void countDown() { 
 delegate.countDown();
}

代码示例来源:origin: io.vertx/vertx-micrometer-metrics

@Override
public void afterStartingVertx(Vertx vertx) {
 ExternalConfigurationTest.this.vertx = vertx;
 startAsync.countDown();
}

代码示例来源:origin: io.vertx/vertx-mysql-postgresql-client-jasync

@Override
 public void handle(AsyncResult<SQLConnection> sqlConnectionAsyncResult) {
  testContext.assertFalse(sqlConnectionAsyncResult.succeeded());
  async.countDown();
 }
};

代码示例来源:origin: vert-x3/vertx-mysql-postgresql-client

@Override
 public void handle(AsyncResult<SQLConnection> sqlConnectionAsyncResult) {
  testContext.assertFalse(sqlConnectionAsyncResult.succeeded());
  async.countDown();
 }
};

代码示例来源:origin: vert-x3/vertx-mysql-postgresql-client

@Override
 public void handle(AsyncResult<SQLConnection> sqlConnectionAsyncResult) {
  testContext.assertFalse(sqlConnectionAsyncResult.succeeded());
  async.countDown();
 }
};

代码示例来源:origin: org.openehealth.ipf.oht.atna/ipf-oht-atna-test

@Override
  public void start() throws Exception {
    NetServer netServer = vertx.createNetServer(nsOptions);
    netServer.connectHandler(netSocket -> netSocket.handler(buffer -> {
      log.debug("================= Received content on " + port + ":" + async.count() +
          " =================== \n" + buffer.toString());
      async.countDown();
    })).listen(port);
  }
}

代码示例来源:origin: io.vertx/vertx-web-client

@Override
 public void start() throws Exception {
  vertx.eventBus().consumer("test", m -> {
   client.get(host, uri).send(ar -> {
    testContext.assertTrue(ar.succeeded());
    async.countDown();            
   });
  });
 }
};

代码示例来源:origin: org.openehealth.ipf.commons/ipf-commons-audit

@Override
  public void start() {
    NetServer netServer = vertx.createNetServer(nsOptions);
    netServer.connectHandler(netSocket -> netSocket.handler(buffer -> {
      LOG.debug("Received content on port {} ({}) : {}", port, async.count(), buffer.toString());
      async.countDown();
    })).listen(port);
  }
}

代码示例来源:origin: io.vertx/vertx-micrometer-metrics

private void runClientRequests(TestContext ctx) {
 Async clientsFinished = ctx.async(concurrentClients);
 for (int i = 0; i < concurrentClients; i++) {
  ForkJoinPool.commonPool().execute(() -> {
   NetClient client = vertx.createNetClient();
   request(client, ctx);
   clientsFinished.countDown();
  });
 }
 clientsFinished.awaitSuccess();
}

代码示例来源:origin: io.vertx/vertx-config

private void getConfigAndCheck(TestContext tc, Async async) {
  getJsonConfiguration(vertx, store, tc.asyncAssertSuccess(res -> {
   if (res.isEmpty()) {
    // Retry as the publication may not have been dispatched yet.
    vertx.setTimer(10, tid -> getConfigAndCheck(tc, async));
   } else {
    ConfigChecker.check(res);
    async.countDown();
   }
  }));
 }
}

代码示例来源:origin: vert-x3/vertx-config

private void getConfigAndCheck(TestContext tc, Async async) {
  getJsonConfiguration(vertx, store, tc.asyncAssertSuccess(res -> {
   if (res.isEmpty()) {
    // Retry as the publication may not have been dispatched yet.
    vertx.setTimer(10, tid -> getConfigAndCheck(tc, async));
   } else {
    ConfigChecker.check(res);
    async.countDown();
   }
  }));
 }
}

代码示例来源:origin: io.vertx/vertx-kafka-client

@Override
 public void start(Future<Void> fut) {
  KafkaConsumer<String, String> consumer = KafkaConsumer.create(vertx, config);
  deployed = true;
  consumer.handler(record -> {
   if (deployed) {
    deployed = false;
    vertx.undeploy(context.deploymentID(), ctx.asyncAssertSuccess(v2 -> async.countDown()));
   }
  });
  consumer.assign(new TopicPartition(topicName, 0), fut);
 }
}, ctx.asyncAssertSuccess(v ->  produceLatch.complete()));

代码示例来源:origin: io.vertx/vertx-rabbitmq-client

@Test
public void testBasicConsumeWithErrorHandler(TestContext ctx) throws Exception {
 int count = 3;
 Set<String> messages = createMessages(count);
 String q = setupQueue(ctx, messages, "application/json");
 Async latch = ctx.async(count);
 vertx.eventBus().consumer("my.address", msg -> ctx.fail("Getting message with malformed json"));
 Handler<Throwable> errorHandler = throwable -> latch.countDown();
 client.basicConsume(q, "my.address", true, ctx.asyncAssertSuccess(), errorHandler);
}

代码示例来源:origin: vert-x3/vertx-rabbitmq-client

@Test
public void testBasicConsumeWithErrorHandler(TestContext ctx) throws Exception {
 int count = 3;
 Set<String> messages = createMessages(count);
 String q = setupQueue(ctx, messages, "application/json");
 Async latch = ctx.async(count);
 vertx.eventBus().consumer("my.address", msg -> ctx.fail("Getting message with malformed json"));
 Handler<Throwable> errorHandler = throwable -> latch.countDown();
 client.basicConsume(q, "my.address", true, ctx.asyncAssertSuccess(), errorHandler);
}

代码示例来源:origin: io.vertx/vertx-mqtt

@Test
public void clientSslTrustAllTest(TestContext context) {
 MqttClientOptions clientOptions = new MqttClientOptions()
  .setSsl(true)
  .setTrustAll(true);
 MqttClient client = MqttClient.create(vertx, clientOptions);
 client.exceptionHandler(t -> context.assertTrue(false));
 this.context = context;
 Async async = context.async();
 client.connect(MQTT_SERVER_TLS_PORT, MQTT_SERVER_HOST, s -> client.disconnect(d -> async.countDown()));
 async.await();
}

代码示例来源:origin: vert-x3/vertx-mqtt

@Test
public void clientSslTrustAllTest(TestContext context) {
 MqttClientOptions clientOptions = new MqttClientOptions()
  .setSsl(true)
  .setTrustAll(true);
 MqttClient client = MqttClient.create(vertx, clientOptions);
 client.exceptionHandler(t -> context.assertTrue(false));
 this.context = context;
 Async async = context.async();
 client.connect(MQTT_SERVER_TLS_PORT, MQTT_SERVER_HOST, s -> client.disconnect(d -> async.countDown()));
 async.await();
}

代码示例来源:origin: vert-x3/vertx-mqtt

@Test
public void clientSslClientTruststoreTest(TestContext context) {
 this.context = context;
 JksOptions jksOptions = new JksOptions().setPath("/tls/client-truststore.jks");
 MqttClientOptions clientOptions = new MqttClientOptions()
  .setSsl(true)
  .setTrustStoreOptions(jksOptions);
 MqttClient client = MqttClient.create(vertx, clientOptions);
 client.exceptionHandler(t -> context.assertTrue(false));
 Async async = context.async();
 client.connect(MQTT_SERVER_TLS_PORT, MQTT_SERVER_HOST, s -> client.disconnect(d -> async.countDown()));
 async.await();
}

代码示例来源:origin: io.vertx/vertx-mqtt

@Test
public void clientSslClientTruststoreTest(TestContext context) {
 this.context = context;
 JksOptions jksOptions = new JksOptions().setPath("/tls/client-truststore.jks");
 MqttClientOptions clientOptions = new MqttClientOptions()
  .setSsl(true)
  .setTrustStoreOptions(jksOptions);
 MqttClient client = MqttClient.create(vertx, clientOptions);
 client.exceptionHandler(t -> context.assertTrue(false));
 Async async = context.async();
 client.connect(MQTT_SERVER_TLS_PORT, MQTT_SERVER_HOST, s -> client.disconnect(d -> async.countDown()));
 async.await();
}

代码示例来源:origin: io.vertx/vertx-consul-client

@Test
public void sessionInfoBlocking(TestContext tc) {
 ctx.writeClient().createSession(tc.asyncAssertSuccess(id -> {
  ctx.readClient().infoSession(id, tc.asyncAssertSuccess(s1 -> {
   Async async = tc.async();
   ctx.readClient().infoSessionWithOptions(id, new BlockingQueryOptions().setIndex(s1.getIndex()), h -> async.countDown());
   vertx.setTimer(1000, l -> {
    assertEquals(async.count(), 1);
    ctx.writeClient().destroySession(id, tc.asyncAssertSuccess());
   });
  }));
 }));
}

相关文章