本文整理了Java中io.vertx.redis.RedisClient.ping
方法的一些代码示例,展示了RedisClient.ping
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisClient.ping
方法的具体详情如下:
包路径:io.vertx.redis.RedisClient
类名称:RedisClient
方法名:ping
[英]Ping the server
[中]Ping服务器
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Ping the server
* @param handler
* @return
*/
public io.vertx.rxjava.redis.RedisClient ping(Handler<AsyncResult<String>> handler) {
delegate.ping(handler);
return this;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Ping the server
* @param handler
* @return
*/
public io.vertx.rxjava.redis.RedisClient ping(Handler<AsyncResult<String>> handler) {
delegate.ping(handler);
return this;
}
代码示例来源:origin: sczyh30/vertx-kue
@Override
public void start(Future<Void> future) throws Exception {
this.config = config();
this.jobService = JobService.create(vertx, config);
// create redis client
RedisClient redisClient = RedisHelper.client(vertx, config);
redisClient.ping(pr -> { // test connection
if (pr.succeeded()) {
logger.info("Kue Verticle is running...");
// register job service
ProxyHelper.registerService(JobService.class, vertx, jobService, EB_JOB_SERVICE_ADDRESS);
future.complete();
} else {
logger.error("oops!", pr.cause());
future.fail(pr.cause());
}
});
}
代码示例来源:origin: io.vertx/vertx-service-discovery
@Test
public void testWithSugar() throws InterruptedException {
Record record = RedisDataSource.createRecord("some-redis-data-source",
new JsonObject().put("url", "localhost"),
new JsonObject().put("database", "some-raw-data"));
discovery.publish(record, r -> {
});
await().until(() -> record.getRegistration() != null);
AtomicBoolean success = new AtomicBoolean();
RedisDataSource.getRedisClient(discovery,
new JsonObject().put("name", "some-redis-data-source"), ar -> {
RedisClient client = ar.result();
client.ping(ar1 -> {
if (ar1.succeeded()) {
client.close(ar2 ->
success.set(ar2.succeeded()));
}
});
});
await().untilAtomic(success, is(true));
}
代码示例来源:origin: vert-x3/vertx-service-discovery
@Test
public void testWithSugar() throws InterruptedException {
Record record = RedisDataSource.createRecord("some-redis-data-source",
new JsonObject().put("url", "localhost"),
new JsonObject().put("database", "some-raw-data"));
discovery.publish(record, r -> {
});
await().until(() -> record.getRegistration() != null);
AtomicBoolean success = new AtomicBoolean();
RedisDataSource.getRedisClient(discovery,
new JsonObject().put("name", "some-redis-data-source"), ar -> {
RedisClient client = ar.result();
client.ping(ar1 -> {
if (ar1.succeeded()) {
client.close(ar2 ->
success.set(ar2.succeeded()));
}
});
});
await().untilAtomic(success, is(true));
}
代码示例来源:origin: io.vertx/vertx-service-discovery
@Test
public void test() throws InterruptedException {
Record record = RedisDataSource.createRecord("some-redis-data-source",
new JsonObject().put("url", "localhost"),
new JsonObject().put("database", "some-raw-data"));
discovery.publish(record, r -> {
});
await().until(() -> record.getRegistration() != null);
AtomicReference<Record> found = new AtomicReference<>();
discovery.getRecord(new JsonObject().put("name", "some-redis-data-source"), ar -> {
found.set(ar.result());
});
await().until(() -> found.get() != null);
ServiceReference service = discovery.getReference(found.get());
RedisClient client = service.get();
AtomicBoolean success = new AtomicBoolean();
client.ping(ar -> {
if (ar.succeeded()) {
client.close(ar2 ->
success.set(ar2.succeeded()));
}
});
await().untilAtomic(success, is(true));
service.release();
// Just there to be sure we can call it twice
service.release();
}
代码示例来源:origin: vert-x3/vertx-service-discovery
@Test
public void test() throws InterruptedException {
Record record = RedisDataSource.createRecord("some-redis-data-source",
new JsonObject().put("url", "localhost"),
new JsonObject().put("database", "some-raw-data"));
discovery.publish(record, r -> {
});
await().until(() -> record.getRegistration() != null);
AtomicReference<Record> found = new AtomicReference<>();
discovery.getRecord(new JsonObject().put("name", "some-redis-data-source"), ar -> {
found.set(ar.result());
});
await().until(() -> found.get() != null);
ServiceReference service = discovery.getReference(found.get());
RedisClient client = service.get();
AtomicBoolean success = new AtomicBoolean();
client.ping(ar -> {
if (ar.succeeded()) {
client.close(ar2 ->
success.set(ar2.succeeded()));
}
});
await().untilAtomic(success, is(true));
service.release();
// Just there to be sure we can call it twice
service.release();
}
内容来源于网络,如有侵权,请联系作者删除!