default Future<Void> sendFile(String filename, long offset, long length) {
Promise<Void> promise = Promise.promise();
sendFile(filename, offset, length, promise);
return promise.future();
}
On 18 Oct 2019, at 17:41, Roman Novikov <myst...@gmail.com> wrote:
Why promise was introduced in 3.8? It seems duplicate functionality with futures.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/998ce325-40a6-48e9-86b1-ff6d31a1951f%40googlegroups.com.
Hi,in Vert.x 4 we use the promise/future and the Future interface removes the completion methods on it, so only Promise can be completed.So a method returning a future creates Promise, keep a reference on the Promise to complete it and returns the Future from the method, e.gdefault Future<Void> sendFile(String filename, long offset, long length) {
Promise<Void> promise = Promise.promise();
sendFile(filename, offset, length, promise);
return promise.future();
}In 3.x the future can still be completed, to avoid breaking but it is deprecated.Julien
On 18 Oct 2019, at 17:41, Roman Novikov <myst...@gmail.com> wrote:
Why promise was introduced in 3.8? It seems duplicate functionality with futures.--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ve...@googlegroups.com.