/** * Un-publishes a record. * @param id the registration id * @param resultHandler handler called when the operation has completed (successfully or not). */ public void unpublish(String id, Handler<AsyncResult<Void>> resultHandler) { delegate.unpublish(id, resultHandler); }
/** * Un-publishes a record. * @param id the registration id * @param resultHandler handler called when the operation has completed (successfully or not). */ public void unpublish(String id, Handler<AsyncResult<Void>> resultHandler) { delegate.unpublish(id, resultHandler); }
@Override public void close(Handler<Void> completionHandler) { List<Future> list = new ArrayList<>(); for (Record record : records) { publisher.unpublish(record.getRegistration(), v -> list.add(v.succeeded() ? Future.succeededFuture() : Future.failedFuture(v.cause()))); } CompositeFuture.all(list).setHandler(ar -> { if (ar.succeeded()) { LOGGER.info("Successfully closed the service importer " + this); } else { LOGGER.error("A failure has been caught while stopping " + this, ar.cause()); } if (completionHandler != null) { completionHandler.handle(null); } } ); }
private void unpublishRecord(Record record, Handler<Void> completionHandler) { publisher.unpublish(record.getRegistration(), ar -> { if (ar.failed()) { LOGGER.error("Cannot unregister kubernetes service", ar.cause()); } else { LOGGER.info("Kubernetes service unregistered from the vert.x registry: " + record.toJson()); if (completionHandler != null) { completionHandler.handle(null); } } }); }
@Override public void close(Handler<Void> completionHandler) { List<Future> list = new ArrayList<>(); for (Record record : records) { publisher.unpublish(record.getRegistration(), v -> list.add(v.succeeded() ? Future.succeededFuture() : Future.failedFuture(v.cause()))); } CompositeFuture.all(list).setHandler(ar -> { if (ar.succeeded()) { LOGGER.info("Successfully closed the service importer " + this); } else { LOGGER.error("A failure has been caught while stopping " + this, ar.cause()); } if (completionHandler != null) { completionHandler.handle(null); } } ); }
/** * Unregisters the service and completes the given future when done, if not {@code null} * * @param publiher the service publisher instance * @param completion the completion future */ public void unregister(ServicePublisher publiher, Future<Void> completion) { if (record.getRegistration() != null) { publiher.unpublish(record.getRegistration(), ar -> { if (ar.succeeded()) { record.setRegistration(null); } if (completion != null) { completion.complete(); } }); } else { if (completion != null) { completion.fail("Record not published"); } } }
/** * Unregisters the service and completes the given future when done, if not {@code null} * * @param publiher the service publisher instance * @param completion the completion future */ public void unregister(ServicePublisher publiher, Future<Void> completion) { if (record.getRegistration() != null) { publiher.unpublish(record.getRegistration(), ar -> { if (ar.succeeded()) { record.setRegistration(null); } if (completion != null) { completion.complete(); } }); } else { if (completion != null) { completion.fail("Record not published"); } } }
private synchronized void unregisterAllServices(Future<Void> done) { List<Future> list = new ArrayList<>(); new HashSet<>(registrations).forEach(reg -> { Future<Void> unreg = Future.future(); publisher.unpublish(reg.record().getRegistration(), unreg.completer()); }); registrations.clear(); CompositeFuture.all(list).setHandler(x -> { if (x.failed()) { done.fail(x.cause()); } else { done.complete(); } }); }
private synchronized void unregisterAllServices(Future<Void> done) { List<Future> list = new ArrayList<>(); new HashSet<>(registrations).forEach(reg -> { Future<Void> unreg = Future.future(); publisher.unpublish(reg.record().getRegistration(), unreg.completer()); }); registrations.clear(); CompositeFuture.all(list).setHandler(x -> { if (x.failed()) { done.fail(x.cause()); } else { done.complete(); } }); }
.map(reg -> { Future<Void> future = Future.future(); publisher.unpublish(reg.record().getRegistration(), v -> { registrations.remove(reg); if (v.succeeded()) {
.map(reg -> { Future<Void> future = Future.future(); publisher.unpublish(reg.record().getRegistration(), v -> { registrations.remove(reg); if (v.succeeded()) {
private void unpublish(DockerService service) { for (Record record : service.records()) { publisher.unpublish(record.getRegistration(), ar -> { LOGGER.info("Service from container " + service.id() + " on location " + record.getLocation() + " has been unpublished"); }); } }