Computationally expensive action
Answered
I have a computationally expensive action that can happen on certain user events. The event does not need to finish before the user continues, so I would like to push the event onto a separate thread. Then there should be no hanging from the user's perspective. Is there a official way to do this in the API or should I just use standard Java threading?
Please sign in to leave a comment.
You can use standard Java threading, but it's preferrable to use Application thread pool.
See `com.intellij.openapi.application.ApplicationManager.getApplication().executeOnPooledThread(Runnable)`, `com.intellij.util.Alarm`, `com.intellij.util.concurrency.AppExecutorUtil.createBoundedApplicationPoolExecutor`.
See also com.intellij.openapi.progress.Task.Modal/Task.Backgroundable, which can be used to start user-visible background task.
See also https://www.jetbrains.org/intellij/sdk/docs/basics/architectural_overview/general_threading_rules.html