Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #323 - IllegalStateException in ContentSource.demand(). #336

Merged
merged 4 commits into from
Dec 18, 2023

Conversation

sbordet
Copy link
Member

@sbordet sbordet commented Dec 6, 2023

Before, the application BiFunction passed to request.response(BiFunction) was called at the "headers" event.

Eventually, a Publisher<T> was returned to the application that could subscribe to it, triggering demand to the internal Publisher<Chunk>, which is triggering the read of Chunks from the Content.Source.

At the same time, the "content source event" may be delivered, triggering also the read of Chunks from the Content.Source.

The solution was to delay the call of the application BiFunction at the "content source event". In this way, there is only one trigger to read Chunks from the Content.Source: when the application demands on the Publisher<T> returned to the application.

Before, the application BiFunction passed to `request.response(BiFunction)` was called at the "headers" event.

Eventually, a `Publisher<T>` was returned to the application that could subscribe to it, triggering demand to the internal `Publisher<Chunk>`, which is triggering the read of `Chunk`s from the `Content.Source`.

At the same time, the "content source event" may be delivered, triggering also the read of `Chunk`s from the `Content.Source`.

The solution was to delay the call of the application BiFunction at the "content source event".
In this way, there is only one trigger to read `Chunk`s from the `Content.Source`: when the application demands on the `Publisher<T>` returned to the application.

Signed-off-by: Simone Bordet <[email protected]>
@sbordet sbordet requested a review from lorban December 6, 2023 14:25
@sbordet sbordet linked an issue Dec 6, 2023 that may be closed by this pull request
Signed-off-by: Simone Bordet <[email protected]>
Signed-off-by: Simone Bordet <[email protected]>
@sbordet sbordet merged commit c55c98a into 4.0.x Dec 18, 2023
6 checks passed
@sbordet sbordet deleted the fix/323/demand_ise branch December 18, 2023 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IllegalStateException in ContentSource.demand()
2 participants