本文整理汇总了Java中io.vertx.core.CompositeFuture.all方法的典型用法代码示例。如果您正苦于以下问题:Java CompositeFuture.all方法的具体用法?Java CompositeFuture.all怎么用?Java CompositeFuture.all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.core.CompositeFuture
的用法示例。
在下文中一共展示了CompositeFuture.all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeServiceClients
import io.vertx.core.CompositeFuture; //导入方法依赖的package包/类
private CompositeFuture closeServiceClients() {
Future<Void> messagingTracker = Future.future();
if (messaging == null) {
messagingTracker.complete();
} else {
messaging.shutdown(messagingTracker.completer());
}
Future<Void> registrationTracker = Future.future();
if (registration == null) {
registrationTracker.complete();
} else {
registration.shutdown(registrationTracker.completer());
}
Future<Void> credentialsTracker = Future.future();
if (credentialsAuthProvider == null) {
credentialsTracker.complete();
} else {
credentialsTracker = credentialsAuthProvider.stop();
}
return CompositeFuture.all(messagingTracker, registrationTracker, credentialsTracker);
}
示例2: getCompositeFuture
import io.vertx.core.CompositeFuture; //导入方法依赖的package包/类
/**
* Gets a composite future using a future for each verticle to be deployed. This composite
* future is successful if all verticles deployed and fails if any verticle fails to deploy.
* @return The composite future
*/
private CompositeFuture getCompositeFuture() {
List<Future<String>> futures = new ArrayList<>();
dependentsDeployment.getConfigurations().forEach(cfg -> futures.addAll(getFutures(cfg)));
return CompositeFuture.all(new ArrayList<>(futures));
}
示例3: startImport
import io.vertx.core.CompositeFuture; //导入方法依赖的package包/类
private CompositeFuture startImport(EthBlock fullBlock) {
StorableBlock block = new StorableBlock(fullBlock.getBlock());
listener.onImportStarted(block.getHash(), block.getNumber());
return CompositeFuture.all(
importBlocks(block),
importTx(block, getTransactionList(fullBlock))
);
}
示例4: deployServiceVerticles
import io.vertx.core.CompositeFuture; //导入方法依赖的package包/类
private CompositeFuture deployServiceVerticles() {
final int maxInstances = config.getMaxInstances();
@SuppressWarnings("rawtypes")
final List<Future> deploymentTracker = new ArrayList<>();
for (ObjectFactory<? extends AbstractServiceBase<?>> serviceFactory : serviceFactories) {
AbstractServiceBase<?> serviceInstance = serviceFactory.getObject();
healthCheckServer.registerHealthCheckResources(serviceInstance);
final Future<String> deployTracker = Future.future();
vertx.deployVerticle(serviceInstance, deployTracker.completer());
deploymentTracker.add(deployTracker);
for (int i = 1; i < maxInstances; i++) { // first instance has already been deployed
serviceInstance = serviceFactory.getObject();
log.debug("created new instance of service: {}", serviceInstance);
final Future<String> tracker = Future.future();
vertx.deployVerticle(serviceInstance, tracker.completer());
deploymentTracker.add(tracker);
}
}
return CompositeFuture.all(deploymentTracker);
}
示例5: deployVerticles
import io.vertx.core.CompositeFuture; //导入方法依赖的package包/类
private Future deployVerticles(AbstractVerticle... verticles) {
Stream<AbstractVerticle> stream = Arrays.stream(verticles);
List<Future> futures = stream
.map(verticle -> {
Future<String> future = Future.<String>future();
vertx.deployVerticle(verticle, future.completer());
return future;
})
.map(future -> (Future) future)
.collect(toList());
return CompositeFuture.all(futures);
}
示例6: start
import io.vertx.core.CompositeFuture; //导入方法依赖的package包/类
@Override
public void start(Future<Void> startPromise) {
VertxResteasyDeployment deployment = new VertxResteasyDeployment();
deployment.start();
deployment.getProviderFactory().registerProvider(DefaultExceptionMapper.class);
deployment.getProviderFactory().registerProvider(JacksonConfig.class);
if (enableRbac) {
log.info("Enabling RBAC for REST API");
deployment.getProviderFactory().registerProviderInstance(new AuthInterceptor(kubernetes));
} else {
log.info("Disabling authentication and authorization for REST API");
deployment.getProviderFactory().registerProviderInstance(new AllowAllAuthInterceptor());
}
deployment.getRegistry().addSingletonResource(new SwaggerSpecEndpoint());
deployment.getRegistry().addSingletonResource(new HttpAddressService(addressSpaceApi));
deployment.getRegistry().addSingletonResource(new HttpSchemaService());
deployment.getRegistry().addSingletonResource(new HttpAddressSpaceService(addressSpaceApi, kubernetes.getNamespace()));
deployment.getRegistry().addSingletonResource(new HttpHealthService());
deployment.getRegistry().addSingletonResource(new HttpV1RootService());
deployment.getRegistry().addSingletonResource(new HttpRootService());
deployment.getRegistry().addSingletonResource(new HttpAddressRootService(addressSpaceApi));
deployment.getRegistry().addSingletonResource(new OSBCatalogService(addressSpaceApi, kubernetes.getNamespace()));
deployment.getRegistry().addSingletonResource(new OSBProvisioningService(addressSpaceApi, kubernetes.getNamespace()));
deployment.getRegistry().addSingletonResource(new OSBBindingService(addressSpaceApi, kubernetes.getNamespace()));
deployment.getRegistry().addSingletonResource(new OSBLastOperationService(addressSpaceApi, kubernetes.getNamespace()));
VertxRequestHandler requestHandler = new VertxRequestHandler(vertx, deployment);
Future<Void> secureReady = Future.future();
Future<Void> openReady = Future.future();
CompositeFuture readyFuture = CompositeFuture.all(secureReady, openReady);
readyFuture.setHandler(result -> {
if (result.succeeded()) {
startPromise.complete();
} else {
startPromise.fail(result.cause());
}
});
createSecureServer(requestHandler, secureReady);
createOpenServer(requestHandler, openReady);
}