Skip to content

Conversation

@vietj
Copy link
Member

@vietj vietj commented Mar 19, 2025

Motivation:

The Vert.x virtual stream programming model provides async/await to interact with asynchronous futures, yet the stream approach has been left naked.

Changes:

A new ReadStream blockingStream default method is added to convert a ReadStream to a java.util.stream.Stream.

This blocking stream can be used from a Vert.x virtual thread or a non Vert.x thread.

When used from a Vert.x virtual thread, each blocking interaction with the stream suspends the virtual thread and release the context ownership to let other tasks process tasks, allowing the context execution to happen and handle pending context tasks.

Motivation:

The Vert.x virtual stream programming model provides async/await to interact with asynchronous futures, yet the stream approach has been left naked.

Changes:

A new ReadStream blockingStream default method is added to convert a ReadStream to a java.util.stream.Stream.

This blocking stream can be used from a Vert.x virtual thread or a non Vert.x thread.

When used from a Vert.x virtual thread, each blocking interaction with the stream suspends the virtual thread and release the context ownership to let other tasks process tasks, allowing the context execution to happen and handle pending context tasks.
@vietj vietj added this to the 5.0.0 milestone Mar 19, 2025
@vietj vietj self-assigned this Mar 19, 2025
@vietj vietj merged commit 9b7be94 into master Mar 19, 2025
7 checks passed
@vietj vietj deleted the blocking-stream branch March 19, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant