Skip to content

Commit

Permalink
=core Remove deperecated usages of CompositeFuture. (#4729)
Browse files Browse the repository at this point in the history
Signed-off-by: He-Pin <[email protected]>
  • Loading branch information
He-Pin authored Jun 19, 2023
1 parent 41eb1a3 commit 6a6870a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/vertx/core/eventbus/impl/EventBusImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,13 @@ public <T> void sendOrPubInternal(MessageImpl message, DeliveryOptions options,

private Future<Void> unregisterAll() {
// Unregister all handlers explicitly - don't rely on context hooks
List<Future> futures = new ArrayList<>();
List<Future<?>> futures = new ArrayList<>();
for (ConcurrentCyclicSequence<HandlerHolder> handlers : handlerMap.values()) {
for (HandlerHolder holder : handlers) {
futures.add(holder.getHandler().unregister());
}
}
return CompositeFuture.join(futures).mapEmpty();
return Future.join(futures).mapEmpty();
}

private void addInterceptor(AtomicReferenceFieldUpdater<EventBusImpl, Handler[]> updater, Handler interceptor) {
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/io/vertx/core/impl/DeploymentManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
package io.vertx.core.impl;

import io.vertx.core.AsyncResult;
import io.vertx.core.CompositeFuture;
import io.vertx.core.Context;
import io.vertx.core.DeploymentOptions;
import io.vertx.core.Future;
Expand Down Expand Up @@ -101,7 +100,7 @@ public Future<Void> undeployAll() {
deploymentIDs.add(entry.getKey());
}
}
List<Future> completionList = new ArrayList<>();
List<Future<?>> completionList = new ArrayList<>();
if (!deploymentIDs.isEmpty()) {
for (String deploymentID : deploymentIDs) {
Promise<Void> promise = Promise.promise();
Expand All @@ -115,7 +114,7 @@ public Future<Void> undeployAll() {
});
}
Promise<Void> promise = vertx.getOrCreateContext().promise();
CompositeFuture.join(completionList).<Void>mapEmpty().onComplete(promise);
Future.join(completionList).<Void>mapEmpty().onComplete(promise);
return promise.future();
} else {
return vertx.getOrCreateContext().succeededFuture();
Expand Down Expand Up @@ -302,16 +301,16 @@ private synchronized void rollback(ContextInternal callingContext, Handler<Async

private synchronized Future<Void> doUndeployChildren(ContextInternal undeployingContext) {
if (!children.isEmpty()) {
List<Future> childFuts = new ArrayList<>();
List<Future<?>> undeployFutures = new ArrayList<>();
for (Deployment childDeployment: new HashSet<>(children)) {
Promise<Void> p = Promise.promise();
childFuts.add(p.future());
undeployFutures.add(p.future());
childDeployment.doUndeploy(undeployingContext).onComplete(ar -> {
children.remove(childDeployment);
p.handle(ar);
});
}
return CompositeFuture.all(childFuts).mapEmpty();
return Future.all(undeployFutures).mapEmpty();
} else {
return Future.succeededFuture();
}
Expand All @@ -326,13 +325,13 @@ public synchronized Future<Void> doUndeploy(ContextInternal undeployingContext)
return doUndeployChildren(undeployingContext).compose(v -> doUndeploy(undeployingContext));
} else {
status = ST_UNDEPLOYED;
List<Future> undeployFutures = new ArrayList<>();
List<Future<?>> undeployFutures = new ArrayList<>();
if (parent != null) {
parent.removeChild(this);
}
for (VerticleHolder verticleHolder: verticles) {
ContextBase context = verticleHolder.context;
Promise p = Promise.promise();
Promise<?> p = Promise.promise();
undeployFutures.add(p.future());
context.runOnContext(v -> {
Promise<Void> stopPromise = undeployingContext.promise();
Expand Down Expand Up @@ -361,7 +360,7 @@ public synchronized Future<Void> doUndeploy(ContextInternal undeployingContext)
});
}
Promise<Void> resolvingPromise = undeployingContext.promise();
CompositeFuture.all(undeployFutures).<Void>mapEmpty().onComplete(resolvingPromise);
Future.all(undeployFutures).<Void>mapEmpty().onComplete(resolvingPromise);
Future<Void> fut = resolvingPromise.future();
Handler<Void> handler = undeployHandler;
if (handler != null) {
Expand Down

0 comments on commit 6a6870a

Please sign in to comment.