provide name for anonymous threads to make stacktraces easier to read

This commit is contained in:
Alexey Kudravtsev
2019-01-23 14:34:27 +03:00
parent 4c13f677c9
commit aed68b6bc8
5 changed files with 5 additions and 5 deletions
@@ -49,7 +49,7 @@ class LightTestMigration {
private static LightTestMigration ourPrevious;
static {
Runtime.getRuntime().addShutdownHook(new Thread(LightTestMigration::flush));
Runtime.getRuntime().addShutdownHook(new Thread(LightTestMigration::flush, "LightTestMigration flusher"));
}
private Path myBaseDir;
@@ -152,7 +152,7 @@ class RetypeSession(
var retypePaused: Boolean = false
private val timerThread = Thread(::runLoop)
private val timerThread = Thread(::runLoop, "RetypeSession loop")
private var stopTimer = false
init {
@@ -171,7 +171,7 @@ public class GlobalMenuLinux implements GlobalMenuLib.EventHandler, Disposable {
PlatformImpl.startup(()->ourLib.startWatchDbus(ourGLogger, ourOnAppmenuServiceAppeared, ourOnAppmenuServiceVanished));
} catch (Throwable e) {
LOG.info("can't start main loop via javaFX (will run it manualy): " + e.getMessage());
final Thread glibMain = new Thread(()->ourLib.runMainLoop(ourGLogger, ourOnAppmenuServiceAppeared, ourOnAppmenuServiceVanished));
final Thread glibMain = new Thread(()->ourLib.runMainLoop(ourGLogger, ourOnAppmenuServiceAppeared, ourOnAppmenuServiceVanished), "GlobalMenuLinux loop");
glibMain.start();
}
} else {
@@ -101,7 +101,7 @@ public class GradleAttachSourcesProvider implements AttachSourcesProvider {
try {
sourcesLocationFile = new File(FileUtil.createTempDirectory("sources", "loc"), "path.tmp");
sourcesLocationFilePath = StringUtil.escapeBackSlashes(sourcesLocationFile.getCanonicalPath());
Runtime.getRuntime().addShutdownHook(new Thread(() -> FileUtil.delete(sourcesLocationFile)));
Runtime.getRuntime().addShutdownHook(new Thread(() -> FileUtil.delete(sourcesLocationFile), "GradleAttachSourcesProvider cleanup"));
}
catch (IOException e) {
GradleLog.LOG.warn(e);
@@ -260,7 +260,7 @@ public class GradleExecutionHelper {
final File scriptFile = new File(wrapperFilesLocation, "gradlew");
final File pathToProperties = new File(wrapperFilesLocation, "path.tmp");
Runtime.getRuntime().addShutdownHook(new Thread(() -> FileUtil.delete(wrapperFilesLocation)));
Runtime.getRuntime().addShutdownHook(new Thread(() -> FileUtil.delete(wrapperFilesLocation), "GradleExecutionHelper cleanup"));
final String[] lines = {
"",
"gradle.projectsEvaluated { gr ->",