Skip to content

Conversation

@leviramsey
Copy link
Contributor

Inspired by a side discussion in #31906, makes the default ExecutionContext for the Classic pipe pattern for Scala futures the parasitic (aka "same thread") context.

The Typed context.pipeToSelf counterpart only uses the parasitic context (the Classic pipe pattern is still required for piping a future to an actor that's not self). For Java futures, the ExecutionContext setting has no effect, but the use of whenComplete in both Classic and Typed has effectively the same semantics.

A local run of MiMa reported no binary issues (a little surprisingly...). Since existing source code is putting a context in the implicit scope (most likely the context/system dispatcher), new/edited code is required in order to take advantage of this, but this does remove a reason to have an implicit ExecutionContext in an actor.

@He-Pin
Copy link
Contributor

He-Pin commented Apr 21, 2023

I was wondering if it was because a BlockingQueue may be used for a mailbox?

@patriknw
Copy link
Contributor

I was wondering if it was because a BlockingQueue may be used for a mailbox?

That can be the original reason. I don't think we should risk introducing any problem by changing this.

@leviramsey
Copy link
Contributor Author

If BlockingQueue is the reason, then that would argue for using whenCompleteAsync on the CompletionStage variant (at least if the EC is an ExecutionContextExecutor), would it not?

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.

3 participants