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
Running promises on specific threads #68
Comments
Wrapping resolutions with a resolver that calls resolve() on a dedicated thread (maybe pulled from an ExecutorService) could be a way to do this. |
Hiya, The |
In theory it should, but it doesn't appear to work as expected. I would expect this to print 'got result' on a different thread to the one that prints 'resolving', but they execute on the same thread, and a stack trace shows both methods on the stack. The situation I would need to use this in would requires that I don't process the callbacks in the thread that's doing the resolving, I have another thread pool for that.
|
Hi
I was looking to start using promises to remove the callback hell I've accumulated in my application, but I need to be able to ensure that a promise is run in a specific thread pool.
I had thought that DefaultDeferredManager.when(Promise) would do just that, but in fact it does nothing.
I was thinking you'd need something like this:
Regards
Stephen
The text was updated successfully, but these errors were encountered: