Add InterruptedException handler to CancellableSimpleLock
#EA-220650 Fixed
This commit is contained in:
committed by
Vladimir Dolzhenko
parent
a9444c386d
commit
ab20b3e083
+5
-3
@@ -57,9 +57,11 @@ internal class PerFileAnalysisCache(val file: KtFile, componentProvider: Compone
|
||||
private val cache = HashMap<PsiElement, AnalysisResult>()
|
||||
private var fileResult: AnalysisResult? = null
|
||||
private val lock = ReentrantLock()
|
||||
private val guardLock = CancellableSimpleLock(lock) {
|
||||
ProgressIndicatorProvider.checkCanceled()
|
||||
}
|
||||
private val guardLock = CancellableSimpleLock(lock,
|
||||
checkCancelled = {
|
||||
ProgressIndicatorProvider.checkCanceled()
|
||||
},
|
||||
interruptedExceptionHandler = { throw ProcessCanceledException(it) })
|
||||
|
||||
private fun check(element: KtElement) {
|
||||
checkWithAttachment(element.containingFile == file, {
|
||||
|
||||
+6
-3
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.caches.resolve
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiElement
|
||||
@@ -51,9 +52,11 @@ internal class ProjectResolutionFacade(
|
||||
get() = globalContext.storageManager.compute { cachedValue.value }
|
||||
|
||||
private val analysisResultsLock = ReentrantLock()
|
||||
private val analysisResultsSimpleLock = CancellableSimpleLock(analysisResultsLock) {
|
||||
ProgressManager.checkCanceled()
|
||||
}
|
||||
private val analysisResultsSimpleLock = CancellableSimpleLock(analysisResultsLock,
|
||||
checkCancelled = {
|
||||
ProgressManager.checkCanceled()
|
||||
},
|
||||
interruptedExceptionHandler = { throw ProcessCanceledException(it) })
|
||||
|
||||
private val analysisResults = CachedValuesManager.getManager(project).createCachedValue(
|
||||
{
|
||||
|
||||
+3
-2
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.caches.resolve.util
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.context.GlobalContextImpl
|
||||
import org.jetbrains.kotlin.idea.project.libraryToSourceAnalysisEnabled
|
||||
@@ -24,9 +25,9 @@ private fun GlobalContextImpl.contextWithCompositeExceptionTracker(debugName: St
|
||||
private fun GlobalContextImpl.contextWithNewLockAndCompositeExceptionTracker(debugName: String): GlobalContextImpl {
|
||||
val newExceptionTracker = CompositeExceptionTracker(this.exceptionTracker)
|
||||
return GlobalContextImpl(
|
||||
LockBasedStorageManager.createWithExceptionHandling(debugName, newExceptionTracker) {
|
||||
LockBasedStorageManager.createWithExceptionHandling(debugName, newExceptionTracker, {
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
},
|
||||
}, { throw ProcessCanceledException(it) }),
|
||||
newExceptionTracker
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user