File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed
utbot-junit-contest/src/main/kotlin/org/utbot Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ enum class Tool {
139
139
classFqn : String
140
140
) {
141
141
val classStats: StatsForClass = try {
142
- withUtContext(UtContext (project.classloader)) {
142
+ withUtContext(ContextManager .createNewContext (project.classloader)) {
143
143
runGeneration(
144
144
project.name,
145
145
cut,
Original file line number Diff line number Diff line change
1
+ package org.utbot.contest
2
+
3
+ import kotlinx.coroutines.cancel
4
+ import kotlinx.coroutines.cancelChildren
5
+ import org.utbot.framework.plugin.api.util.UtContext
6
+
7
+ object ContextManager {
8
+ private val currentContexts = mutableListOf<UtContext >()
9
+
10
+ fun createNewContext (classLoader : ClassLoader ) =
11
+ UtContext (classLoader).apply {
12
+ currentContexts.add(this )
13
+ }
14
+
15
+ fun cancelAll () {
16
+ currentContexts.forEach {
17
+ it.cancelChildren()
18
+ it.cancel()
19
+ }
20
+ currentContexts.clear()
21
+ }
22
+
23
+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import org.utbot.common.ThreadBasedExecutor
14
14
import org.utbot.common.bracket
15
15
import org.utbot.common.info
16
16
import org.utbot.contest.ContestEstimatorJdkInfoProvider
17
+ import org.utbot.contest.ContextManager
17
18
import org.utbot.contest.GlobalStats
18
19
import org.utbot.contest.Paths
19
20
import org.utbot.contest.Tool
@@ -76,8 +77,7 @@ fun main(args: Array<String>) {
76
77
77
78
}
78
79
79
- utContext.cancelChildren()
80
- utContext.cancel()
80
+ ContextManager .cancelAll()
81
81
ConcreteExecutor .defaultPool.forceTerminateProcesses()
82
82
System .gc()
83
83
}
You can’t perform that action at this time.
0 commit comments