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

Add Async#evalOn(executor) or Async#evalOnExecutor(executor) #3633

Closed
armanbilge opened this issue May 15, 2023 · 3 comments · Fixed by #3691
Closed

Add Async#evalOn(executor) or Async#evalOnExecutor(executor) #3633

armanbilge opened this issue May 15, 2023 · 3 comments · Fixed by #3691

Comments

@armanbilge
Copy link
Member

Async#evalOn takes a Scala ExecutionContext but frequently this functionality is needed for running on a Java Executor.

  • ExecutionContext.fromExecutor(...) can be used to get an ExecutionContext from an Executor

  • We can do even better, by using the current ExecutionContexts reportFailure method for the new ExecutionContext built from the Executor. This is better than the default reporter.

@homycdev
Copy link
Contributor

Just to understand more clearly. You would like to add def evalOn[F](ec: ExecutionContext) = ??? inside object Async?

Or you want to change the initialization of the blockingExectionContext so when it fails, it would generate a report through reportFailure ?

@armanbilge
Copy link
Member Author

You would like to add def evalOn[F](ec: ExecutionContext) = ??? inside object Async?

We already have this one :)

/**
* Shift execution of the effect `fa` to the execution context `ec`. Execution is shifted back
* to the previous execution context when `fa` completes.
*
* evalOn(executionContext, ec) <-> pure(ec)
*/
def evalOn[A](fa: F[A], ec: ExecutionContext): F[A]

I propose we add:

def evalOn[A](fa: F[A], exec: java.util.concurrent.Executor): F[A] 

@homycdev
Copy link
Contributor

@armanbilge could you please review the PR attached to the issue, if possible? If you could not, I'd be glad if you'd tell me who could review the PR. Thanks!

@armanbilge armanbilge linked a pull request May 17, 2023 that will close this issue
@armanbilge armanbilge linked a pull request Jul 9, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants