scala / scala/scala-java8-compat

Execution context being lost after using FutureConverters

Open
#179 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
438
Forks
63
Avg merge
5h 12m
Merged PRs (30d)
2

Description

https://github.com/scala/scala-java8-compat/blob/05be2b2c0e56bdda0ca0519ff5ff7e7d0f2a17be/src/main/scala/scala/concurrent/java8/FutureConvertersImpl.scala#L35

After converting a scala future to a java future, the synchronous functions are implemented by calling async ones.
And it's not using the ones that are taking the extra executor parameter. https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html#thenApplyAsync-java.util.function.Function-

In this case, thread local values will be lost including the execution context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/main/scala/scala/concurrent/java8/FutureConvertersImpl.scala around line 35 and read the synchronous conversion methods alongside the Java CompletableFuture thenApplyAsync documentation. Trace which executor is used and verify that execution-context and thread-local values are preserved after conversion; the issue names no test file, so add or run the relevant conversion tests if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.