Skip to content

About command parallelism... #2391

Discussion options

You must be logged in to vote

There are a lot of things you can do to solve this problem, most importantly you should look into reducing how long your commands take.

  • Do not use complete(), instead rely only on queue(...) callbacks
  • Avoid using anything that is blocking, such as Thread.sleep(...) or Future#get

If you have a lot of CPU computations, for example due to image processing, then you will have to use a thread-pool instead. Note, however, that you are still limited by how much your CPU can handle at a time.

To use a thread-pool, make a globally accessible (e.g. static) field that you can re-use everywhere. This allows you to avoid leaking resources by creating excessive threads everywhere.

There are multiple …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ks0927
Comment options

Answer selected by MinnDevelopment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants