-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
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.