Remove explicit AppScheduledExecutorService shutdown (commit revert)

Revert "Problem: manually shutdown AppScheduledExecutorService to allow compiler stop properly"

The commit was added during update to 162.1024.1 to fix hangs in ant
tasks on teamcity because of some thread created in
AppScheduledExecutorService service.

Remove the commit because can't reproduce those hangs under 162.2946
(Probably https://github.com/JetBrains/intellij-community/commit/12a079ef41882343bf83ef2a7dcee820b55fd154 fixed the hangs).

This should also be addressed in fix for https://youtrack.jetbrains.com/issue/IDEA-169562

This reverts commit 99a75021e1.
This commit is contained in:
Nikolay Krasko
2017-03-14 16:04:35 +03:00
parent a63953432e
commit f38753ee3c
4 changed files with 8 additions and 33 deletions
@@ -16,8 +16,6 @@
package org.jetbrains.kotlin.serialization.builtins package org.jetbrains.kotlin.serialization.builtins
import com.intellij.util.concurrency.AppExecutorUtil
import com.intellij.util.concurrency.AppScheduledExecutorService
import java.io.File import java.io.File
fun main(args: Array<String>) { fun main(args: Array<String>) {
@@ -43,13 +41,7 @@ found top-level declarations to <destination dir> (*.kotlin_builtins files)"""
val missing = srcDirs.filterNot(File::exists) val missing = srcDirs.filterNot(File::exists)
assert(missing.isEmpty()) { "These source directories are missing: $missing" } assert(missing.isEmpty()) { "These source directories are missing: $missing" }
try { BuiltInsSerializer(dependOnOldBuiltIns = false).serialize(destDir, srcDirs, listOf()) { totalSize, totalFiles ->
BuiltInsSerializer(dependOnOldBuiltIns = false).serialize(destDir, srcDirs, listOf()) { totalSize, totalFiles -> println("Total bytes written: $totalSize to $totalFiles files")
println("Total bytes written: $totalSize to $totalFiles files")
}
}
finally {
val service = AppExecutorUtil.getAppScheduledExecutorService() as AppScheduledExecutorService
service.shutdownAppScheduledExecutorService()
} }
} }
@@ -20,8 +20,6 @@ import com.google.common.base.Predicates;
import com.intellij.openapi.Disposable; import com.intellij.openapi.Disposable;
import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.SystemInfo;
import com.intellij.util.concurrency.AppExecutorUtil;
import com.intellij.util.concurrency.AppScheduledExecutorService;
import kotlin.collections.ArraysKt; import kotlin.collections.ArraysKt;
import kotlin.jvm.functions.Function1; import kotlin.jvm.functions.Function1;
import org.fusesource.jansi.AnsiConsole; import org.fusesource.jansi.AnsiConsole;
@@ -379,16 +377,9 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
// We depend on swing (indirectly through PSI or something), so we want to declare headless mode, // We depend on swing (indirectly through PSI or something), so we want to declare headless mode,
// to avoid accidentally starting the UI thread // to avoid accidentally starting the UI thread
System.setProperty("java.awt.headless", "true"); System.setProperty("java.awt.headless", "true");
try { ExitCode exitCode = doMainNoExit(compiler, args);
ExitCode exitCode = doMainNoExit(compiler, args); if (exitCode != OK) {
System.exit(exitCode.getCode());
if (exitCode != OK) {
System.exit(exitCode.getCode());
}
}
finally {
AppScheduledExecutorService service = (AppScheduledExecutorService) AppExecutorUtil.getAppScheduledExecutorService();
service.shutdownAppScheduledExecutorService();
} }
} }
@@ -105,7 +105,6 @@ import org.jetbrains.kotlin.script.KotlinScriptDefinitionProvider
import org.jetbrains.kotlin.script.KotlinScriptExternalImportsProvider import org.jetbrains.kotlin.script.KotlinScriptExternalImportsProvider
import org.jetbrains.kotlin.utils.PathUtil import org.jetbrains.kotlin.utils.PathUtil
import java.io.File import java.io.File
import java.lang.IllegalStateException
import java.util.* import java.util.*
class KotlinCoreEnvironment private constructor( class KotlinCoreEnvironment private constructor(
@@ -16,9 +16,9 @@
@file:JvmName("PreprocessorCLI") @file:JvmName("PreprocessorCLI")
package org.jetbrains.kotlin.preprocessor package org.jetbrains.kotlin.preprocessor
import com.intellij.util.concurrency.AppExecutorUtil
import com.intellij.util.concurrency.AppScheduledExecutorService
import java.io.File import java.io.File
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
fun main(args: Array<String>) { fun main(args: Array<String>) {
if (args.size != 3) { if (args.size != 3) {
@@ -32,12 +32,5 @@ fun main(args: Array<String>) {
val profile = createProfile(args[2], targetPath) val profile = createProfile(args[2], targetPath)
println("Preprocessing sources in $sourcePath to $targetPath with profile ${profile.name}") println("Preprocessing sources in $sourcePath to $targetPath with profile ${profile.name}")
Preprocessor().processSources(sourcePath, profile)
try {
Preprocessor().processSources(sourcePath, profile)
}
finally {
val service = AppExecutorUtil.getAppScheduledExecutorService() as AppScheduledExecutorService
service.shutdownAppScheduledExecutorService()
}
} }