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)
- Blocked thread during vertx startup HOT 1
- Configurable socket keep alive interval HOT 3
- Hash based load balancing policy
- ver.4.5.6 HttpServerRequest.isExpectMultipart wrong results returned.
- Vertx pooled allocator should be the same as Netty
- Fix for CVE-2024-29025
- Fix for CVE-2024-29025
- BlockedThreadChecker does not check a parking event loop virtual thread HOT 8
- Websocket batch processing / read completion event HOT 3
- webSocketHandler does not accept incoming websocket connection since vertx-core version 4.5.6 and later HOT 1
- Jackson's Hybrid pool should avoid using predicates to verify Thread::isVirtual HOT 1
- Provide an option to wait for all currently-being-processed / currently-queued requests / events to complete before closing vertx HOT 1
- JsonObject: The equals method fails when comparing integers with floats. HOT 1
- Request .send method invocation starts failing from 4.5.5 onward HOT 11
- route BodyHandler before ProxyHandler, response [ERROR] [2024-04-17 18:57:27] ?.?(?) | Connection was closed HOT 2
- Vertx eventbus not working even after cluster formation
- Getting HttpClosedException: Connection was closed for alternate HTTP API calls HOT 1
- Previously clustered instances incorrectly cached
- Vert.x does not respond appropriately for HTTP/1.1 request containing no Host header HOT 3
- Vertx Compatibility issue HOT 1
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.