eclipse-vertx / eclipse-vertx/vert.x
Future#fromCompletionStage(CompletionStage) with Context if it exists
Open
enhancement
- Dominant language
- Java
- Stars
- 14.7k
- Forks
- 2.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 28
Description
Current version:
```
static Future fromCompletionStage(CompletionStage completionStage) {
Promise promise = Promise.promise();
completionStage.whenComplete((value, err) -> {
```
isn't it better to supply Vert.x context if it "exists"
```
static Future fromCompletionStage(CompletionStage completionStage) {
Context ctx = Vertx.currentContext();
Promise promise = (ctx instanceof ContextInternal) // ⇒ ≠ null
? ((ContextInternal)ctx).promise()
: Promise.promise();
completionStage.whenComplete((value, err) -> {
```
Contributor guide
Assessment
This issue has not been assessed yet.