Comments (7)
the transform
javadoc says: When this future (the one on which transform
is called) completes, the mapper
will be called with the async result and this mapper returns another future object.
It is possible to extrapolate that join returns a composite future that when it is a success is resolved with the composite future. However as soon as you call transform
on this future, then the contract of transform
applies.
It is specified that the mapper
receives an asynchronous result and not the current future. It turns out it was practical to pass the current future in the initial implementation but this can create leak since the transform operation needs to keep a reference onto the future that created it.
Therefore if the result of join is a success then the mapper of transform is called with an asynchronous result for which the composite future can be obtained with the result of this async result, e.g transform(ar -> { ... ar.result() <- CompositeFuture ... })
from vert.x.
cc @vietj
from vert.x.
thanks
from vert.x.
@Fyro-Ing I see what you mean but this actually seems to be an abuse of the API, if you want to use the composite future. Simply keep a reference on it like
@Test
public void join() {
waitFor(1);
final Future<String> f1 = Future.failedFuture(new RuntimeException());
final Future<String> f2 = Future.failedFuture(new RuntimeException());
CompositeFuture cf = Future.join(f1, f2);
cf
.transform(ar -> {
// Use CF
return (CompositeFuture) ar;
})
.onComplete(ar -> {
complete();
});
await();
}
from vert.x.
I suppose that sample as error with ar cast vs cf
This is a breaking change, because transform use previous result, and now, this is not the case.
And now, we need a reference and can't use fluent API directly :/
from vert.x.
from vert.x.
I'm not sure how to understand your response, but ar (result from #join) is not a CompositeFuture now, this is a breaking change, from method contract ^^
from vert.x.
Related Issues (20)
- handle of SNI has a problem HOT 1
- Support IPv6 and IPv4 dual-stack network listening HOT 3
- Add setDefaultServer toHttpClientOptions HOT 1
- Inconsistency in pooled-but-unused TCP connection error between Windows and Linux/MacOs HOT 4
- vertx-core jar quarantined due to incorrect CVE vulnerability by Sonatype HOT 7
- Verticle getting deployed in Event Model when its setup for Worker Model using Deployment Options. HOT 2
- Update Netty version to allow retries with TCP on timeout HOT 2
- Reduce the number of eventloops started by default HOT 3
- SIGSEGV during SSL.freeSSL when multiple instances are deployed HOT 1
- WebClient through kerberos secured proxy is not working HOT 3
- HttpClient drops original proxy on redirect
- Vertx in native image throws error: This Java runtime does not support virtual threads HOT 18
- OutOfMemoryException after CRL update HOT 2
- Firefox WebSocket: server cannot upgrade manually HOT 1
- More load balancing policies HOT 2
- vertx.getOrCreateContext() returns different instances HOT 3
- Blocked thread during vertx startup HOT 1
- Configurable socket keep alive interval HOT 3
- Hash based load balancing policy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vert.x.