io.vertx.redis.RedisClient.close()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(175)

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

RedisClient.close介绍

[英]Close the client - when it is fully closed the handler will be called.
[中]关闭客户端-当客户端完全关闭时,将调用处理程序。

代码示例

代码示例来源:origin: cescoffier/vertx-workshop

public void close() {
  redis.close(v -> {
  });
 }
}

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

/**
 * Close the client - when it is fully closed the handler will be called.
 * @param handler 
 */
public void close(Handler<AsyncResult<Void>> handler) { 
 delegate.close(handler);
}

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

@Override
 protected void onClose() {
  service.close(ar -> {
  });
 }
}

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

@Override
 protected void onClose() {
  service.close(ar -> {
  });
 }
}

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

/**
 * Close the client - when it is fully closed the handler will be called.
 * @param handler 
 */
public void close(Handler<AsyncResult<Void>> handler) { 
 delegate.close(handler);
}

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

@Override
public void close(Handler<Void> completionHandler) {
 redis.close(ar -> completionHandler.handle(null));
}

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

@Override
public void close(Handler<Void> completionHandler) {
 redis.close(ar -> completionHandler.handle(null));
}

代码示例来源: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();
}

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

@After
public void tearDown(TestContext tc) {
 retriever.close();
 testRedisClient.close(tc.asyncAssertSuccess());
 vertx.close(tc.asyncAssertSuccess());
 redisServer.stop();
}

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

@After
public void tearDown(TestContext tc) {
 retriever.close();
 testRedisClient.close(tc.asyncAssertSuccess());
 vertx.close(tc.asyncAssertSuccess());
 redisServer.stop();
}

相关文章

RedisClient类方法