本文整理汇总了Java中io.vertx.servicediscovery.ServiceDiscovery.close方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceDiscovery.close方法的具体用法?Java ServiceDiscovery.close怎么用?Java ServiceDiscovery.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.servicediscovery.ServiceDiscovery
的用法示例。
在下文中一共展示了ServiceDiscovery.close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: should_Cleanup_Unused_Consumers_On_Closing_Managed_Discovery
import io.vertx.servicediscovery.ServiceDiscovery; //导入方法依赖的package包/类
@Test
public void should_Cleanup_Unused_Consumers_On_Closing_Managed_Discovery() {
discoveryRegistrar = DiscoveryRegistrar.create(vertx);
ServiceDiscovery discovery1 = discoveryRegistrar.startListening(
new ServiceDiscoveryOptions().setName("discovery1"), record -> {}, refData -> {}).getDiscovery();
ServiceDiscovery discovery2 = discoveryRegistrar.startListening(
new ServiceDiscoveryOptions().setName("discovery1"), record -> {}, refData -> {}).getDiscovery();
ServiceDiscovery discovery3 = discoveryRegistrar.startListening(
new ServiceDiscoveryOptions().setName("discovery2").setAnnounceAddress("otherAnnounce"),
record -> {}, refData -> {}).getDiscovery();
assertEquals(2, discoveryRegistrar.serviceDiscoveryNames().size());
assertNotNull(discoveryRegistrar.getDiscovery("discovery1"));
assertEquals(discoveryRegistrar.getDiscovery("discovery1"), discovery2);
assertNotEquals(discoveryRegistrar.getDiscovery("discovery2"), discoveryRegistrar.getDiscovery("discovery3"));
// TODO Complete test
discovery1.close();
}
示例2: example1
import io.vertx.servicediscovery.ServiceDiscovery; //导入方法依赖的package包/类
public void example1(Vertx vertx) {
// Use default configuration
ServiceDiscovery discovery = ServiceDiscovery.create(vertx);
// Customize the configuration
discovery = ServiceDiscovery.create(vertx,
new ServiceDiscoveryOptions()
.setAnnounceAddress("service-announce")
.setName("my-name"));
// Do something...
discovery.close();
}
示例3: should_Invoke_Close_Action_When_Closing_Managed_Discovery
import io.vertx.servicediscovery.ServiceDiscovery; //导入方法依赖的package包/类
@Test
public void should_Invoke_Close_Action_When_Closing_Managed_Discovery(TestContext context) {
Async async = context.async();
AtomicInteger check = new AtomicInteger(1);
final Action<Void> closeAction = () -> {
assertEquals(0, check.decrementAndGet());
async.complete();
return null;
};
ServiceDiscovery discovery = ManagedServiceDiscovery.of(
ServiceDiscovery.create(vertx, new ServiceDiscoveryOptions().setName("discovery2")), closeAction);
discovery.close();
}
开发者ID:engagingspaces,项目名称:vertx-graphql-service-discovery,代码行数:15,代码来源:ManagedServiceDiscoveryTest.java