From dbd689fecbee9cca6e647c038bb046993efcc440 Mon Sep 17 00:00:00 2001 From: "Svetlana.Zemlyanskaya" Date: Mon, 1 Jun 2020 18:40:56 +0200 Subject: [PATCH] LAB-29: add custom executor for next file prediction GitOrigin-RevId: 3c93a055049d9c1d981302903a850bed4930bf89 --- .../com/intellij/filePrediction/FilePredictionHandler.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/filePrediction/src/com/intellij/filePrediction/FilePredictionHandler.kt b/plugins/filePrediction/src/com/intellij/filePrediction/FilePredictionHandler.kt index 0a9e4463eb10..50843ef49d31 100644 --- a/plugins/filePrediction/src/com/intellij/filePrediction/FilePredictionHandler.kt +++ b/plugins/filePrediction/src/com/intellij/filePrediction/FilePredictionHandler.kt @@ -10,7 +10,7 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.project.impl.ProjectManagerImpl import com.intellij.openapi.util.registry.Registry import com.intellij.openapi.vfs.VirtualFile -import com.intellij.util.concurrency.NonUrgentExecutor +import com.intellij.util.concurrency.SequentialTaskExecutor class FilePredictionHandler(private val project: Project) : Disposable { companion object { @@ -19,6 +19,7 @@ class FilePredictionHandler(private val project: Project) : Disposable { fun getInstance(project: Project): FilePredictionHandler? = ServiceManager.getService(project, FilePredictionHandler::class.java) } + private val executor = SequentialTaskExecutor.createSequentialApplicationPoolExecutor("NextFilePrediction") private val manager: FilePredictionSessionManager init { @@ -31,7 +32,7 @@ class FilePredictionHandler(private val project: Project) : Disposable { return } - NonUrgentExecutor.getInstance().execute { + executor.submit { BackgroundTaskUtil.runUnderDisposeAwareIndicator(this, Runnable { val start = System.currentTimeMillis() FilePredictionHistory.getInstance(project).onFileSelected(newFile.url) @@ -45,5 +46,6 @@ class FilePredictionHandler(private val project: Project) : Disposable { } override fun dispose() { + executor.shutdown() } } \ No newline at end of file