Skip to content

Commit

Permalink
Adapt to CompositeFuture changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed May 16, 2023
1 parent 49c3f5a commit cf2a6b0
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package io.vertx.servicediscovery.backend.consul;

import io.vertx.core.AsyncResult;
import io.vertx.core.CompositeFuture;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Promise;
Expand Down Expand Up @@ -121,9 +120,9 @@ public void getRecords(Handler<AsyncResult<List<Record>>> resultHandler) {
});
return recordFutureList;
})
.compose(CompositeFuture::all)
.compose(Future::all)
.map(c -> c.<ServiceList>list().stream().flatMap(l -> l.getList().stream()).map(this::serviceToRecord).collect(Collectors.toList()))
.compose(CompositeFuture::all)
.compose(Future::all)
.map(c -> c.list().stream().map(o -> (Record) o).collect(Collectors.toList()))
.onComplete(resultHandler);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public void getRecords(Handler<AsyncResult<List<Record>>> resultHandler) {
futures.add(promise.future());
}

CompositeFuture.all(futures)
Future.all(futures)
.onComplete(
ar -> runOnContextIfPossible(context, () -> {
if (ar.failed()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.vertx.servicediscovery.consul;

import io.vertx.core.CompositeFuture;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Promise;
Expand Down Expand Up @@ -141,7 +140,7 @@ private void retrieveIndividualServices(ServiceList list, Promise<List<ImportedC
futures.add(promise.future());
});

CompositeFuture.all(futures).onComplete(ar -> {
Future.all(futures).onComplete(ar -> {
if (ar.failed()) {
LOGGER.error("Fail to retrieve the services from consul", ar.cause());
} else {
Expand Down Expand Up @@ -232,7 +231,7 @@ private void importService(List<ServiceEntry> list, Promise<List<ImportedConsulS
registrations.add(registration.future());
}

CompositeFuture.all(registrations).onComplete(ar -> {
Future.all(registrations).onComplete(ar -> {
if (ar.succeeded()) {
future.complete(importedServices);
} else {
Expand Down Expand Up @@ -312,7 +311,7 @@ public synchronized void close(Handler<Void> completionHandler) {
imported.unregister(publisher, promise);
});

CompositeFuture.all(list).onComplete(ar -> {
Future.all(list).onComplete(ar -> {
clearImportedServices();
if (ar.succeeded()) {
LOGGER.info("Successfully closed the service importer " + this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.vertx.servicediscovery.docker;

import io.vertx.core.CompositeFuture;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Promise;
Expand Down Expand Up @@ -144,7 +143,7 @@ public void close(Handler<Void> completionHandler) {
publisher.unpublish(record.getRegistration()).onComplete(v -> list.add(v.succeeded() ? Future.succeededFuture() : Future.failedFuture(v.cause())));
}

CompositeFuture.all(list).onComplete(ar -> {
Future.all(list).onComplete(ar -> {
if (ar.succeeded()) {
LOGGER.info("Successfully closed the service importer " + this);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private CompositeFuture publishRecords(JsonArray items) {
publications.add(promise.future());
}
});
return CompositeFuture.all(publications);
return Future.all(publications);
}

private void watch() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.vertx.servicediscovery.zookeeper;

import io.vertx.core.CompositeFuture;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Promise;
Expand Down Expand Up @@ -157,7 +156,7 @@ private synchronized void compute(Promise<Void> done) {
}).forEach(actions::add);

if (done != null) {
CompositeFuture.all(actions).onComplete(ar -> {
Future.all(actions).onComplete(ar -> {
if (ar.succeeded()) {
done.complete(null);
} else {
Expand Down Expand Up @@ -249,7 +248,7 @@ private synchronized void unregisterAllServices(Promise<Void> done) {
});
registrations.clear();

CompositeFuture.all(list).onComplete(x -> {
Future.all(list).onComplete(x -> {
if (x.failed()) {
done.fail(x.cause());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public void close() {
bindings.forEach(ServiceReference::release);
bindings.clear();

CompositeFuture.all(futures).onComplete(ar -> {
Future.all(futures).onComplete(ar -> {
if (ar.succeeded()) {
LOGGER.info("Discovery bridges stopped");
} else {
Expand Down

0 comments on commit cf2a6b0

Please sign in to comment.