8000 support CompletionStage in SynchronizationContext (executeLater) · Issue #11668 · grpc/grpc-java · GitHub
[go: up one dir, main page]

Skip to content
support CompletionStage in SynchronizationContext (executeLater) #11668
@pjfanning

Description

@pjfanning

Is your feature request related to a problem?

Idea would be to add an executeLater(CompletionStage<?> future) method.
SynchronizationContext would store a CompletionStage variable and each new executeLater would be composed onto the existing CompletionStage so that they all run in order.

Describe the solution you'd like

It might be useful to keep the Queue of Runnables but after the first CompletionStage is added via executeLater, all subsequent executes (synchronous or asynchronous) would be added to the first CompletionStage so that these tasks continue to run in order (that they were added).

Describe alternatives you've considered

In #11662, we are being pushed towards using SynchronizationContext instead of using Scala asynchronous constructs like Future, ZIO, etc. It is feasible to wrap these Scala constructs as Java CompletionStages so that the API in grpc-java remains Java specific.

Additional context

The aim is not to force pekko-grpc and other non-Java frameworks to have to rewrite their async code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0