-
Notifications
You must be signed in to change notification settings - Fork 6
Wrong example usage of CompletableFututure's async methods #13
Comments
While I second using proper asynchronous programming instead of blocking on additional threads, what is it meant to be used for if not for long-running or blocking operations? |
It's meant for computational tasks, not for blocking tasks. E.g., parallel streams is a perfect example that uses the common pool, too. |
What would you suggest for a blocking task instead? |
Either use an own or Javacord's executor service or just don't block.
The common pool size is limited to the core count of the machine, so there's a difference. |
Ah, yes, makes sense of course. |
We have examples like this in the docs:
thenAcceptAsync(...)
and other async methods use theForkJoinPool.commonPool()
by default. This pool is bound to the nuber of cpu cores and is not meant to be used for blocking operations.The text was updated successfully, but these errors were encountered: