Skip to content

Commit fd3df19

Browse files
committed
perf(provider): wrap file search in runReadAction
- Encapsulate the file search logic within a runReadAction block - This change ensures that the file search operation is performed in a read action, improving thread safety and performance in multi-threaded environments
1 parent b1e132e commit fd3df19

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

java/src/main/kotlin/cc/unitmesh/idea/provider/JavaRefactoringTool.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ class JavaRefactoringTool : RefactoringTool {
2727
val className = elementInfo.className
2828
val packageName = elementInfo.pkgName
2929

30-
val sourceFile = javaFiles.firstOrNull {
31-
it.packageName == packageName && it.name == "$className.java"
30+
val sourceFile = runReadAction {
31+
javaFiles.firstOrNull {
32+
it.packageName == packageName && it.name == "$className.java"
33+
}
3234
} ?: return null
3335

3436
return sourceFile

0 commit comments

Comments
 (0)