From 606818b9ffd23c03743a6083a45e7941576a11c4 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 5 Jun 2015 14:44:27 +0300 Subject: [PATCH] do not use anonymous threads --- .../com/intellij/find/FindManagerTest.java | 4 ++-- .../jps/service/impl/SharedThreadPoolImpl.java | 5 +++-- .../com/intellij/dvcs/push/PushController.java | 3 ++- .../VcsRepositoryManagerTest.java | 4 ++-- .../debugger/extensions/PlaybackDebugger.java | 4 ++-- .../com/intellij/diagnostic/DialogAppender.java | 4 ++-- .../actions/TestErrorViewAction.java | 4 ++-- .../ide/ui/laf/darcula/ui/DarculaTest.java | 4 ++-- .../src/com/intellij/idea/Launcher.java | 6 +++--- .../internal/focus/FocusDebuggerAction.java | 6 +++++- .../CheckMessagesButtonsOrderAction.java | 2 +- .../notification/impl/MacEventReader.java | 5 +++-- .../ShowDelayedMessageInternalAction.java | 4 ++-- .../progress/impl/ProgressManagerImpl.java | 2 +- .../openapi/ui/playback/PlaybackRunner.java | 4 ++-- .../src/org/jetbrains/io/PowerSupplyKit.java | 4 ++-- .../progress/impl/ProgressIndicatorTest.java | 9 ++++++--- .../intellij/util/lang/UrlClassLoaderTest.java | 5 +++-- .../remoteServer/agent/util/log/LogPipe.java | 4 ++-- .../sm/OutputLineSplitterTest.java | 4 ++-- .../intellij/openapi/util/ShutDownTracker.java | 4 ++-- .../openapi/util/io/WinUACTemporaryFix.java | 11 +++++++---- .../src/com/intellij/util/EnvironmentUtil.java | 4 ++-- .../util/src/com/intellij/util/Restarter.java | 4 ++-- .../com/intellij/util/io/BaseOutputReader.java | 5 +++-- .../util/src/com/intellij/util/ui/UIUtil.java | 2 +- .../intellij/openapi/util/io/IoTestUtil.java | 2 +- .../util/containers/ConcurrentBitSetTest.java | 6 +++--- .../committed/MockDelayingChangeProvider.java | 9 ++++++--- .../lib/cvsclient/RequestProcessor.java | 3 ++- .../java/decompiler/main/rels/ClassWrapper.java | 2 +- .../execution/junit/JUnitDebuggerRunner.java | 2 +- .../maven/indices/MavenIndicesStressTest.java | 8 ++++---- ...licationLevelNumberConnectionsGuardImpl.java | 5 +++-- .../jetbrains/idea/svn/SvnBusyOnAddTest.java | 4 ++-- .../idea/svn/SvnCachingRepositoryPoolTest.java | 6 +++--- .../org/jetbrains/idea/svn/SvnLockingTest.java | 16 ++++++++-------- .../idea/svn/VcsWaitForUpdateForTest.java | 4 ++-- .../idea/svn16/VcsWaitForUpdateForTest.java | 4 ++-- .../terminal/vfs/TerminalSessionEditor.java | 6 ++++-- .../uiDesigner/snapShooter/SnapShooter.java | 6 +++--- .../plugins/xslt/run/rt/XSLTRunner.java | 2 +- .../rt/engine/local/LocalDebugger.java | 2 +- .../plugins/ipnb/protocol/IpnbConnection.java | 4 ++-- .../plugins/ipnb/protocol/IpnbConnectionV3.java | 2 +- .../debugger/array/AsyncArrayTableModel.java | 7 +++---- .../env/python/console/PyConsoleTask.java | 17 ++++++++++++++++- .../env/python/debug/PyBaseDebuggerTask.java | 17 ++++++++++++++++- .../com/intellij/updater/SwingUpdaterUI.java | 4 ++-- .../util/xml/DomConcurrencyStressTest.java | 4 ++-- 50 files changed, 155 insertions(+), 104 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java index 384fdc3eb339..d28bd8294614 100644 --- a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java +++ b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -150,7 +150,7 @@ public class FindManagerTest extends DaemonAnalyzerTestCase { final int offset, final FindResult[] op_result){ op_result[0] = null; - Thread findThread = new Thread(){ + Thread findThread = new Thread("find man test"){ @Override public void run(){ op_result[0] = findManager.findString(text, offset, model); diff --git a/jps/model-impl/src/org/jetbrains/jps/service/impl/SharedThreadPoolImpl.java b/jps/model-impl/src/org/jetbrains/jps/service/impl/SharedThreadPoolImpl.java index b4bd1eb947e2..3f107a366c37 100644 --- a/jps/model-impl/src/org/jetbrains/jps/service/impl/SharedThreadPoolImpl.java +++ b/jps/model-impl/src/org/jetbrains/jps/service/impl/SharedThreadPoolImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package org.jetbrains.jps.service.impl; +import com.intellij.util.ConcurrencyUtil; import org.jetbrains.jps.service.SharedThreadPool; import java.util.concurrent.ExecutorService; @@ -25,7 +26,7 @@ import java.util.concurrent.Future; * @author nik */ public class SharedThreadPoolImpl extends SharedThreadPool { - private final ExecutorService myService = Executors.newCachedThreadPool(); + private final ExecutorService myService = Executors.newCachedThreadPool(ConcurrencyUtil.newNamedThreadFactory("JPS thread pool")); @Override public void execute(Runnable command) { diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java b/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java index 69cad5ec36e1..d9b9e1a0f572 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java @@ -32,6 +32,7 @@ import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Disposer; import com.intellij.ui.CheckedTreeNode; +import com.intellij.util.ConcurrencyUtil; import com.intellij.util.Function; import com.intellij.util.ObjectUtils; import com.intellij.util.containers.ContainerUtil; @@ -69,7 +70,7 @@ public class PushController implements Disposable { @Nullable private final Repository myCurrentlyOpenedRepository; private final boolean mySingleRepoProject; private static final int DEFAULT_CHILDREN_PRESENTATION_NUMBER = 20; - private final ExecutorService myExecutorService = Executors.newSingleThreadExecutor(); + private final ExecutorService myExecutorService = Executors.newSingleThreadExecutor(ConcurrencyUtil.newNamedThreadFactory("DVCS Push")); private final Map> myView2Model = new TreeMap>(); diff --git a/platform/dvcs-impl/testSrc/com.intellij.dvcs/VcsRepositoryManagerTest.java b/platform/dvcs-impl/testSrc/com.intellij.dvcs/VcsRepositoryManagerTest.java index 022a644570ce..c45b606398bc 100644 --- a/platform/dvcs-impl/testSrc/com.intellij.dvcs/VcsRepositoryManagerTest.java +++ b/platform/dvcs-impl/testSrc/com.intellij.dvcs/VcsRepositoryManagerTest.java @@ -138,12 +138,12 @@ public class VcsRepositoryManagerTest extends UsefulTestCase { return !myGlobalRepositoryManager.getRepositories().isEmpty(); } }); - new Thread(modifyRepositoryMapping).start(); + new Thread(modifyRepositoryMapping,"vcs modify").start(); //wait until modification starts assertTrue(LOCK_ERROR_TEXT, READY_TO_READ.await(1, TimeUnit.SECONDS)); - new Thread(readExistingRepo).start(); + new Thread(readExistingRepo,"vcs read").start(); assertNotNull(readExistingRepo.get(1, TimeUnit.SECONDS)); CONTINUE_MODIFY.countDown(); assertTrue(modifyRepositoryMapping.get(1, TimeUnit.SECONDS)); diff --git a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java index 3177196a090b..383e50cb874d 100644 --- a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java +++ b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -400,7 +400,7 @@ public class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunner.Sta } } - new Thread() { + new Thread("playback debugger") { @Override public void run() { new WaitFor(60000) { diff --git a/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.java b/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.java index 1e9f2a1fbc50..165613cb534f 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.java +++ b/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -122,7 +122,7 @@ public class DialogAppender extends AppenderSkeleton { final Application app = ApplicationManager.getApplication(); if (app == null) { - new Thread(myDialogRunnable).start(); + new Thread(myDialogRunnable, "dialog appender logger").start(); } else { app.executeOnPooledThread(myDialogRunnable); diff --git a/platform/platform-impl/src/com/intellij/ide/errorTreeView/actions/TestErrorViewAction.java b/platform/platform-impl/src/com/intellij/ide/errorTreeView/actions/TestErrorViewAction.java index 14623be062f2..52635295ee59 100644 --- a/platform/platform-impl/src/com/intellij/ide/errorTreeView/actions/TestErrorViewAction.java +++ b/platform/platform-impl/src/com/intellij/ide/errorTreeView/actions/TestErrorViewAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ public abstract class TestErrorViewAction extends AnAction{ openView(project, view.getComponent()); myMillis = 0L; myMessageCount = 0; - new Thread() { + new Thread("test error view") { public void run() { for (int idx = 0; idx < MESSAGE_COUNT; idx++) { addMessage(view, new String[] {"This is a warning test message" + idx + " line1", "This is a warning test message" + idx + " line2"}, MessageCategory.WARNING); diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java index 695a530654b9..87db7cdbdb6d 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,7 +78,7 @@ public class DarculaTest { @Override public void actionPerformed(ActionEvent e) { myStartButton.setEnabled(false); - new Thread(){ + new Thread("darcula test"){ @Override public void run() { while (myProgressBar2.getValue() < 100) { diff --git a/platform/platform-impl/src/com/intellij/idea/Launcher.java b/platform/platform-impl/src/com/intellij/idea/Launcher.java index 8c45e3073eaa..03641c3b9361 100644 --- a/platform/platform-impl/src/com/intellij/idea/Launcher.java +++ b/platform/platform-impl/src/com/intellij/idea/Launcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +30,8 @@ public class Launcher { String classpath = System.getProperty("java.class.path"); try { final Process process = Runtime.getRuntime().exec("cmd " + javaVmExecutablePath + " -cp " + classpath + " com.intellij.idea.Main"); - new Thread(new Redirector(process.getErrorStream(), System.err)).start(); - new Thread(new Redirector(process.getInputStream(), System.out)).start(); + new Thread(new Redirector(process.getErrorStream(), System.err), "Redirector err").start(); + new Thread(new Redirector(process.getInputStream(), System.out), "Redirector out").start(); process.waitFor(); } catch (IOException e) { System.out.println("Can't launch java VM executable: " + e.getMessage()); diff --git a/platform/platform-impl/src/com/intellij/internal/focus/FocusDebuggerAction.java b/platform/platform-impl/src/com/intellij/internal/focus/FocusDebuggerAction.java index 22fdd346d80c..9f8d78f6122e 100644 --- a/platform/platform-impl/src/com/intellij/internal/focus/FocusDebuggerAction.java +++ b/platform/platform-impl/src/com/intellij/internal/focus/FocusDebuggerAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,6 +63,10 @@ public class FocusDebuggerAction extends AnAction implements DumbAware { private boolean myRunning = true; + public FocusDrawer() { + super("focus debugger"); + } + public void setRunning(final boolean running) { myRunning = running; } diff --git a/platform/platform-impl/src/com/intellij/internal/validation/CheckMessagesButtonsOrderAction.java b/platform/platform-impl/src/com/intellij/internal/validation/CheckMessagesButtonsOrderAction.java index a783fc97e542..3e28560955c2 100644 --- a/platform/platform-impl/src/com/intellij/internal/validation/CheckMessagesButtonsOrderAction.java +++ b/platform/platform-impl/src/com/intellij/internal/validation/CheckMessagesButtonsOrderAction.java @@ -31,7 +31,7 @@ public class CheckMessagesButtonsOrderAction extends AnAction implements DumbAw @Override public void actionPerformed(AnActionEvent e) { - new Thread() { + new Thread("check messages") { @Override public void run() { super.run(); diff --git a/platform/platform-impl/src/com/intellij/notification/impl/MacEventReader.java b/platform/platform-impl/src/com/intellij/notification/impl/MacEventReader.java index 795934be0443..f441eba7c7cc 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/MacEventReader.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/MacEventReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.util.ConcurrencyUtil; import org.jetbrains.annotations.NotNull; import java.io.IOException; @@ -89,7 +90,7 @@ class MacEventReader { private static synchronized ExecutorService getService() { if (ourService == null) { - ourService = Executors.newSingleThreadExecutor(); + ourService = Executors.newSingleThreadExecutor(ConcurrencyUtil.newNamedThreadFactory("Mac event reader")); } return ourService; } diff --git a/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java b/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java index a870b9373302..aa4d7e06c7b7 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public class ShowDelayedMessageInternalAction extends AnAction implements DumbAw @Override public void actionPerformed(AnActionEvent e) { - new Thread() { + new Thread("show delayed msg") { @Override public void run() { super.run(); diff --git a/platform/platform-impl/src/com/intellij/openapi/progress/impl/ProgressManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/progress/impl/ProgressManagerImpl.java index 38d0b812f5bd..b10d4a2ddc60 100644 --- a/platform/platform-impl/src/com/intellij/openapi/progress/impl/ProgressManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/progress/impl/ProgressManagerImpl.java @@ -60,7 +60,7 @@ public class ProgressManagerImpl extends CoreProgressManager implements Disposab @TestOnly public static void runWithAlwaysCheckingCanceled(@NotNull Runnable runnable) { - Thread fake = new Thread(); + Thread fake = new Thread("fake"); try { threadsUnderCanceledIndicator.add(fake); runnable.run(); diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java index c0f642196bec..988dabaf0993 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,7 +117,7 @@ public class PlaybackRunner { parse(); - new Thread() { + new Thread("playback runner") { @Override public void run() { if (myUseDirectActionCall) { diff --git a/platform/platform-impl/src/org/jetbrains/io/PowerSupplyKit.java b/platform/platform-impl/src/org/jetbrains/io/PowerSupplyKit.java index 16c23e102155..084281ab006f 100644 --- a/platform/platform-impl/src/org/jetbrains/io/PowerSupplyKit.java +++ b/platform/platform-impl/src/org/jetbrains/io/PowerSupplyKit.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ public class PowerSupplyKit { if (!shouldCheckCordUnplug) return; - new Thread() { + new Thread("check power") { @Override public void run() { startListenPowerSupply(new PowerSupplyKitCallback() { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java index 4cc218a4297c..caaa29162479 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java @@ -20,13 +20,16 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.intellij.openapi.progress.*; -import com.intellij.openapi.progress.util.*; +import com.intellij.openapi.progress.util.ProgressIndicatorBase; +import com.intellij.openapi.progress.util.ProgressIndicatorUtils; +import com.intellij.openapi.progress.util.ProgressWrapper; +import com.intellij.openapi.progress.util.ReadTask; import com.intellij.openapi.util.EmptyRunnable; import com.intellij.openapi.wm.ex.ProgressIndicatorEx; +import com.intellij.testFramework.BombedProgressIndicator; import com.intellij.testFramework.LightPlatformTestCase; import com.intellij.testFramework.PlatformTestCase; import com.intellij.testFramework.PlatformTestUtil; -import com.intellij.testFramework.BombedProgressIndicator; import com.intellij.util.*; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.DoubleArrayList; @@ -173,7 +176,7 @@ public class ProgressIndicatorTest extends LightPlatformTestCase { } }, indicator); } - }){{start();}}; + },"indicator test"){{start();}}; } }); ContainerUtil.process(threads, new Processor() { diff --git a/platform/platform-tests/testSrc/com/intellij/util/lang/UrlClassLoaderTest.java b/platform/platform-tests/testSrc/com/intellij/util/lang/UrlClassLoaderTest.java index 69fdaf7e104c..407d930e35d6 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/lang/UrlClassLoaderTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/lang/UrlClassLoaderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package com.intellij.util.lang; import com.intellij.openapi.application.PathManager; +import com.intellij.util.ConcurrencyUtil; import com.intellij.util.containers.ContainerUtil; import gnu.trove.TIntObjectHashMap; import gnu.trove.TIntObjectProcedure; @@ -117,7 +118,7 @@ public class UrlClassLoaderTest extends TestCase { int threadCount = 3; final int resourceCount = 20; - ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(threadCount); + ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(threadCount, ConcurrencyUtil.newNamedThreadFactory("conc loading")); final Random random = new Random(); UrlClassLoader.CachePool pool = UrlClassLoader.createCachePool(); for (int attempt = 0; attempt < attemptCount; attempt++) { diff --git a/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/log/LogPipe.java b/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/log/LogPipe.java index bfedfffb720b..6356fb60eab9 100644 --- a/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/log/LogPipe.java +++ b/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/log/LogPipe.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public abstract class LogPipe { myTotalLines = 0; myLines2Skip = 0; - new Thread() { + new Thread("log pipe") { @Override public void run() { diff --git a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputLineSplitterTest.java b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputLineSplitterTest.java index 5e6bf8247d03..6fd0ca976b40 100644 --- a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputLineSplitterTest.java +++ b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputLineSplitterTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -205,7 +205,7 @@ public class OutputLineSplitterTest extends UsefulTestCase { result.setException(e); } } - }).start(); + },"line split").start(); return result; } } diff --git a/platform/util/src/com/intellij/openapi/util/ShutDownTracker.java b/platform/util/src/com/intellij/openapi/util/ShutDownTracker.java index f9e282eb6153..8faee3400708 100644 --- a/platform/util/src/com/intellij/openapi/util/ShutDownTracker.java +++ b/platform/util/src/com/intellij/openapi/util/ShutDownTracker.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -153,7 +153,7 @@ public class ShutDownTracker implements Runnable { runnable.run(); semaphore.up(); } - }).start(); + },"shutdown tracker invoker").start(); semaphore.waitFor(1000); } else { diff --git a/platform/util/src/com/intellij/openapi/util/io/WinUACTemporaryFix.java b/platform/util/src/com/intellij/openapi/util/io/WinUACTemporaryFix.java index 31404f110c36..2b0c586435ef 100644 --- a/platform/util/src/com/intellij/openapi/util/io/WinUACTemporaryFix.java +++ b/platform/util/src/com/intellij/openapi/util/io/WinUACTemporaryFix.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,10 @@ package com.intellij.openapi.util.io; import com.intellij.openapi.application.PathManager; -import java.io.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; /** * @author gregsh @@ -43,8 +46,8 @@ class WinUACTemporaryFix { private static boolean execExternalProcess(String[] args) throws IOException, InterruptedException { Process process = Runtime.getRuntime().exec(args); - Thread outThread = new Thread(new StreamRedirector(process.getInputStream(), System.out)); - Thread errThread = new Thread(new StreamRedirector(process.getErrorStream(), System.err)); + Thread outThread = new Thread(new StreamRedirector(process.getInputStream(), System.out),"winua redirector out"); + Thread errThread = new Thread(new StreamRedirector(process.getErrorStream(), System.err),"winua redirector err"); outThread.start(); errThread.start(); diff --git a/platform/util/src/com/intellij/util/EnvironmentUtil.java b/platform/util/src/com/intellij/util/EnvironmentUtil.java index 97fdcb1517e4..3e6725ea79bf 100644 --- a/platform/util/src/com/intellij/util/EnvironmentUtil.java +++ b/platform/util/src/com/intellij/util/EnvironmentUtil.java @@ -46,7 +46,7 @@ public class EnvironmentUtil { private static final Future> ourEnvGetter; static { if (SystemInfo.isMac && "unlocked".equals(System.getProperty("__idea.mac.env.lock")) && Registry.is("idea.fix.mac.env")) { - ExecutorService executor = Executors.newSingleThreadExecutor(); + ExecutorService executor = Executors.newSingleThreadExecutor(ConcurrencyUtil.newNamedThreadFactory("get shell env")); ourEnvGetter = executor.submit(new Callable>() { @Override public Map call() throws Exception { @@ -207,7 +207,7 @@ public class EnvironmentUtil { public void killAfter(long timeout) { final long stop = System.currentTimeMillis() + timeout; - new Thread() { + new Thread("kill after") { @Override public void run() { synchronized (myWaiter) { diff --git a/platform/util/src/com/intellij/util/Restarter.java b/platform/util/src/com/intellij/util/Restarter.java index aa0f024463a5..8c5c30b59431 100644 --- a/platform/util/src/com/intellij/util/Restarter.java +++ b/platform/util/src/com/intellij/util/Restarter.java @@ -89,8 +89,8 @@ public class Restarter { try { Process process = Runtime.getRuntime().exec(beforeRestart); - Thread outThread = new Thread(new StreamRedirector(process.getInputStream(), System.out)); - Thread errThread = new Thread(new StreamRedirector(process.getErrorStream(), System.err)); + Thread outThread = new Thread(new StreamRedirector(process.getInputStream(), System.out),"restarter redirector out"); + Thread errThread = new Thread(new StreamRedirector(process.getErrorStream(), System.err),"restarter redirector err"); outThread.start(); errThread.start(); diff --git a/platform/util/src/com/intellij/util/io/BaseOutputReader.java b/platform/util/src/com/intellij/util/io/BaseOutputReader.java index 3ddbf5b447a7..b945cbe7f060 100644 --- a/platform/util/src/com/intellij/util/io/BaseOutputReader.java +++ b/platform/util/src/com/intellij/util/io/BaseOutputReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package com.intellij.util.io; +import com.intellij.util.ConcurrencyUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -59,7 +60,7 @@ public abstract class BaseOutputReader extends BaseDataReader { if (!(reader instanceof BaseInputStreamReader)) { throw new IllegalArgumentException("Blocking policy can be used only with BaseInputStreamReader, that doesn't lock on close"); } - myExecutorService = Executors.newSingleThreadExecutor(); + myExecutorService = Executors.newSingleThreadExecutor(ConcurrencyUtil.newNamedThreadFactory("Base output reader")); myTokenSubmitter = new Runnable() { @Override public void run() { diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index 2f54b9bcc57b..8435cde5dc29 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -3219,7 +3219,7 @@ public class UIUtil { LOG.info(ignore); } } - }).start(); + },"play sound").start(); } // Experimental!!! diff --git a/platform/util/testSrc/com/intellij/openapi/util/io/IoTestUtil.java b/platform/util/testSrc/com/intellij/openapi/util/io/IoTestUtil.java index 58df3fc1bfe7..e7fddbcafd39 100644 --- a/platform/util/testSrc/com/intellij/openapi/util/io/IoTestUtil.java +++ b/platform/util/testSrc/com/intellij/openapi/util/io/IoTestUtil.java @@ -212,7 +212,7 @@ public class IoTestUtil { throw new RuntimeException(e); } } - }).start(); + },"io test").start(); return process.waitFor(); } diff --git a/platform/util/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java b/platform/util/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java index 6dd5329e4c2f..f5fb2d43332a 100644 --- a/platform/util/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java +++ b/platform/util/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,7 @@ public class ConcurrentBitSetTest extends TestCase { } } } - }); + },"conc bit set"); threads[i] = thread; thread.start(); } @@ -111,7 +111,7 @@ public class ConcurrentBitSetTest extends TestCase { } } } - }); + },"conc bit stress"); threads[i] = thread; thread.start(); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/MockDelayingChangeProvider.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/MockDelayingChangeProvider.java index 02c0919a0f81..91e27f0d8beb 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/MockDelayingChangeProvider.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/MockDelayingChangeProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,10 @@ package com.intellij.openapi.vcs.changes.committed; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.vcs.VcsException; -import com.intellij.openapi.vcs.changes.*; +import com.intellij.openapi.vcs.changes.ChangeListManagerGate; +import com.intellij.openapi.vcs.changes.ChangeProvider; +import com.intellij.openapi.vcs.changes.ChangelistBuilder; +import com.intellij.openapi.vcs.changes.VcsDirtyScope; import com.intellij.openapi.vfs.VirtualFile; import java.util.List; @@ -65,7 +68,7 @@ public class MockDelayingChangeProvider implements ChangeProvider { runnable.run(); } } - }); + },"vcs delaying execute"); } } } diff --git a/plugins/cvs/javacvs-src/org/netbeans/lib/cvsclient/RequestProcessor.java b/plugins/cvs/javacvs-src/org/netbeans/lib/cvsclient/RequestProcessor.java index 3b54101dc1d5..cb81b208b9c5 100644 --- a/plugins/cvs/javacvs-src/org/netbeans/lib/cvsclient/RequestProcessor.java +++ b/plugins/cvs/javacvs-src/org/netbeans/lib/cvsclient/RequestProcessor.java @@ -12,6 +12,7 @@ */ package org.netbeans.lib.cvsclient; +import com.intellij.util.ConcurrencyUtil; import com.intellij.util.concurrency.Semaphore; import org.jetbrains.annotations.NonNls; import org.netbeans.lib.cvsclient.command.CommandAbortedException; @@ -232,7 +233,7 @@ public final class RequestProcessor implements IRequestProcessor { @Override protected void callRunnable(Runnable runnable) { - myFuture = Executors.newSingleThreadExecutor().submit(runnable); + myFuture = Executors.newSingleThreadExecutor(ConcurrencyUtil.newNamedThreadFactory("CVS request")).submit(runnable); final long tOut = (myTimeout < 20000) ? 20000 : myTimeout; while (true) { diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java index 1b4a13451823..18f05a34329a 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java @@ -91,7 +91,7 @@ public class ClassWrapper { else { MethodProcessorRunnable mtProc = new MethodProcessorRunnable(mt, varProc, DecompilerContext.getCurrentContext()); - Thread mtThread = new Thread(mtProc); + Thread mtThread = new Thread(mtProc, "Java decompiler"); long stopAt = System.currentTimeMillis() + maxSec * 1000; mtThread.start(); diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnitDebuggerRunner.java b/plugins/junit/src/com/intellij/execution/junit/JUnitDebuggerRunner.java index e9c7b4424306..9326f0559ce2 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnitDebuggerRunner.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnitDebuggerRunner.java @@ -61,7 +61,7 @@ public class JUnitDebuggerRunner extends GenericDebuggerRunner { final RunContentDescriptor res = super.createContentDescriptor(state, environment); final ServerSocket socket = ((JavaTestFrameworkRunnableState)state).getForkSocket(); if (socket != null) { - Thread thread = new Thread() { + Thread thread = new Thread("junit debugger runner") { @Override public void run() { try { diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/indices/MavenIndicesStressTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/indices/MavenIndicesStressTest.java index ec4542c8d7e8..580d849bf7e9 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/indices/MavenIndicesStressTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/indices/MavenIndicesStressTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public abstract class MavenIndicesStressTest extends MavenIndicesTestCase implem isFinished.set(true); } } - }); + },"maven index 1"); Thread t2 = new Thread(new Runnable() { @Override @@ -71,7 +71,7 @@ public abstract class MavenIndicesStressTest extends MavenIndicesTestCase implem fail(); } } - }); + }, "maven index 2"); t1.start(); t2.start(); @@ -147,7 +147,7 @@ public abstract class MavenIndicesStressTest extends MavenIndicesTestCase implem finishedCount.incrementAndGet(); } } - }); + },"maven test"); return t2; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/svnkit/lowLevel/ApplicationLevelNumberConnectionsGuardImpl.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/svnkit/lowLevel/ApplicationLevelNumberConnectionsGuardImpl.java index b66a8c966f03..24d5e1a9f69e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/svnkit/lowLevel/ApplicationLevelNumberConnectionsGuardImpl.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/svnkit/lowLevel/ApplicationLevelNumberConnectionsGuardImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; +import com.intellij.util.ConcurrencyUtil; import com.intellij.util.containers.hash.HashSet; import org.tmatesoft.svn.core.SVNErrorCode; import org.tmatesoft.svn.core.SVNErrorMessage; @@ -55,7 +56,7 @@ public class ApplicationLevelNumberConnectionsGuardImpl implements Disposable, A public ApplicationLevelNumberConnectionsGuardImpl() { myDelay = DELAY; mySet = new HashSet(); - myService = Executors.newSingleThreadScheduledExecutor(); + myService = Executors.newSingleThreadScheduledExecutor(ConcurrencyUtil.newNamedThreadFactory("SVN connection")); myLock = new Object(); myDisposed = false; myRecheck = new Runnable() { diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnBusyOnAddTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnBusyOnAddTest.java index 1afccd7673e7..4f9b1dfa46d0 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnBusyOnAddTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnBusyOnAddTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -149,7 +149,7 @@ public class SvnBusyOnAddTest extends TestCase { exception[0] = e; } } - }).start(); + },"svn test").start(); semaphoreMain.waitFor(); TimeoutUtil.sleep(5); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRepositoryPoolTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRepositoryPoolTest.java index a72386554503..c9ca1afc96df 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRepositoryPoolTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRepositoryPoolTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -110,7 +110,7 @@ public class SvnCachingRepositoryPoolTest extends FileBasedTest { public void run() { ((ProgressManagerImpl)ProgressManager.getInstance()).executeProcessUnderProgress(target, indicator); } - }); + }, "svn cache repo"); thread.start(); TimeoutUtil.sleep(10); @@ -184,7 +184,7 @@ public class SvnCachingRepositoryPoolTest extends FileBasedTest { } } }; - Thread thread = new Thread(target); + Thread thread = new Thread(target, "svn cache"); thread.start(); } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLockingTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLockingTest.java index 471540b4f649..7e4dc310d7e6 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLockingTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLockingTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,8 +86,8 @@ public class SvnLockingTest extends TestCase { final HangInWrite operation1 = new HangInWrite("one_"); final HangInWrite operation2 = new HangInWrite("two_"); - final Thread thread1 = new Thread(operation1); - final Thread thread2 = new Thread(operation2); + final Thread thread1 = new Thread(operation1,"op1"); + final Thread thread2 = new Thread(operation2,"op2"); try { thread1.start(); waitForRunning(operation1); @@ -115,8 +115,8 @@ public class SvnLockingTest extends TestCase { final OnlyWrite operation1 = new OnlyWrite("one"); final OnlyWrite operation2 = new OnlyWrite("two"); - final Thread thread1 = new Thread(operation1); - final Thread thread2 = new Thread(operation2); + final Thread thread1 = new Thread(operation1,"one"); + final Thread thread2 = new Thread(operation2,"two"); try { thread1.start(); @@ -190,9 +190,9 @@ public class SvnLockingTest extends TestCase { final HangInWrite operation2 = new HangInWrite("two1"); final HangInRead read = new HangInRead("READ"); - final Thread thread1 = new Thread(operation1); - final Thread threadRead = new Thread(read); - final Thread thread2 = new Thread(operation2); + final Thread thread1 = new Thread(operation1,"op1"); + final Thread threadRead = new Thread(read,"read1"); + final Thread thread2 = new Thread(operation2,"op2"); try { thread1.start(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/VcsWaitForUpdateForTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/VcsWaitForUpdateForTest.java index 46fddfd5fa9c..9477478950cb 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/VcsWaitForUpdateForTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/VcsWaitForUpdateForTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ public class VcsWaitForUpdateForTest extends Svn17TestCase { lock.notifyAll(); } } - }); + },"vcs refresh"); thread.start(); synchronized (lock) { diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/VcsWaitForUpdateForTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/VcsWaitForUpdateForTest.java index ab864d9c303f..99d4a89be958 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/VcsWaitForUpdateForTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/VcsWaitForUpdateForTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ public class VcsWaitForUpdateForTest extends Svn16TestCase { lock.notifyAll(); } } - }); + },"svn6 refresh"); thread.start(); synchronized (lock) { diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/vfs/TerminalSessionEditor.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/vfs/TerminalSessionEditor.java index 5dc7b629af57..dc3c192a5f79 100644 --- a/plugins/terminal/src/org/jetbrains/plugins/terminal/vfs/TerminalSessionEditor.java +++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/vfs/TerminalSessionEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.UserDataHolderBase; +import com.intellij.util.ConcurrencyUtil; import com.jediterm.terminal.TtyConnectorWaitFor; import com.jediterm.terminal.ui.TerminalAction; import com.jediterm.terminal.ui.TerminalActionProviderBase; @@ -71,7 +72,8 @@ public class TerminalSessionEditor extends UserDataHolderBase implements FileEdi } }); - myWaitFor = new TtyConnectorWaitFor(myFile.getTerminal().getTtyConnector(), Executors.newSingleThreadExecutor()); + myWaitFor = new TtyConnectorWaitFor(myFile.getTerminal().getTtyConnector(), Executors.newSingleThreadExecutor( + ConcurrencyUtil.newNamedThreadFactory("Terminal session"))); myWaitFor .setTerminationCallback(new Predicate() { diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/SnapShooter.java b/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/SnapShooter.java index 8104c541b5ae..9e72896ba88c 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/SnapShooter.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/SnapShooter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package com.intellij.uiDesigner.snapShooter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.net.URLClassLoader; import java.net.URL; +import java.net.URLClassLoader; /** * @author yole @@ -44,7 +44,7 @@ public class SnapShooter { Thread.currentThread().setContextClassLoader(loader); } - final Thread thread = new Thread(new SnapShooterDaemon(port)); + final Thread thread = new Thread(new SnapShooterDaemon(port),"snapshooter"); thread.setDaemon(true); thread.start(); diff --git a/plugins/xpath/xslt-rt/src/org/intellij/plugins/xslt/run/rt/XSLTRunner.java b/plugins/xpath/xslt-rt/src/org/intellij/plugins/xslt/run/rt/XSLTRunner.java index b2e919c341ac..1f26feaad067 100644 --- a/plugins/xpath/xslt-rt/src/org/intellij/plugins/xslt/run/rt/XSLTRunner.java +++ b/plugins/xpath/xslt-rt/src/org/intellij/plugins/xslt/run/rt/XSLTRunner.java @@ -123,7 +123,7 @@ public class XSLTRunner implements XSLTMain { } } - Runtime.getRuntime().addShutdownHook(new Thread() { + Runtime.getRuntime().addShutdownHook(new Thread("XSLT runner") { public void run() { try { final Writer out = result.getWriter(); diff --git a/plugins/xslt-debugger/engine/impl/src/org/intellij/plugins/xsltDebugger/rt/engine/local/LocalDebugger.java b/plugins/xslt-debugger/engine/impl/src/org/intellij/plugins/xsltDebugger/rt/engine/local/LocalDebugger.java index 4c997ac0ef41..7ac209c6a620 100644 --- a/plugins/xslt-debugger/engine/impl/src/org/intellij/plugins/xsltDebugger/rt/engine/local/LocalDebugger.java +++ b/plugins/xslt-debugger/engine/impl/src/org/intellij/plugins/xsltDebugger/rt/engine/local/LocalDebugger.java @@ -70,7 +70,7 @@ public class LocalDebugger implements Debugger { stopped(); } } - }); + },"local debugger"); } protected void prepareTransformer(Transformer transformer) { diff --git a/python/ipnb/src/org/jetbrains/plugins/ipnb/protocol/IpnbConnection.java b/python/ipnb/src/org/jetbrains/plugins/ipnb/protocol/IpnbConnection.java index a0f206afb058..b682d2e6f022 100644 --- a/python/ipnb/src/org/jetbrains/plugins/ipnb/protocol/IpnbConnection.java +++ b/python/ipnb/src/org/jetbrains/plugins/ipnb/protocol/IpnbConnection.java @@ -79,11 +79,11 @@ public class IpnbConnection { public void onError(@NotNull Exception e) { } }; - myShellThread = new Thread(myShellClient); + myShellThread = new Thread(myShellClient, "IPNB shell client"); myShellThread.start(); myIOPubClient = new IpnbWebSocketClient(getIOPubURI(), draft); - myIOPubThread = new Thread(myIOPubClient); + myIOPubThread = new Thread(myIOPubClient, "IPNB pub client"); myIOPubThread.start(); } diff --git a/python/ipnb/src/org/jetbrains/plugins/ipnb/protocol/IpnbConnectionV3.java b/python/ipnb/src/org/jetbrains/plugins/ipnb/protocol/IpnbConnectionV3.java index 18da4c902b35..0c524673378f 100644 --- a/python/ipnb/src/org/jetbrains/plugins/ipnb/protocol/IpnbConnectionV3.java +++ b/python/ipnb/src/org/jetbrains/plugins/ipnb/protocol/IpnbConnectionV3.java @@ -23,7 +23,7 @@ public class IpnbConnectionV3 extends IpnbConnection{ final Draft draft = new Draft17WithOrigin(); myChannelsClient = new IpnbWebSocketClient(getChannelsURI(), draft); - myChannelsThread = new Thread(myChannelsClient); + myChannelsThread = new Thread(myChannelsClient, "IPNB channel client"); myChannelsThread.start(); } diff --git a/python/src/com/jetbrains/python/debugger/array/AsyncArrayTableModel.java b/python/src/com/jetbrains/python/debugger/array/AsyncArrayTableModel.java index 14c1e5cf02c4..1947968c843e 100644 --- a/python/src/com/jetbrains/python/debugger/array/AsyncArrayTableModel.java +++ b/python/src/com/jetbrains/python/debugger/array/AsyncArrayTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,13 +21,12 @@ import com.google.common.cache.LoadingCache; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFutureTask; import com.intellij.openapi.util.Pair; +import com.intellij.util.ConcurrencyUtil; import com.intellij.util.ui.UIUtil; import com.jetbrains.python.debugger.ArrayChunk; import com.jetbrains.python.debugger.PyDebugValue; import javax.swing.table.AbstractTableModel; -import java.util.HashMap; -import java.util.Map; import java.util.concurrent.*; /** @@ -43,7 +42,7 @@ public class AsyncArrayTableModel extends AbstractTableModel { private final NumpyArrayTable myProvider; - private final ExecutorService myExecutorService = Executors.newSingleThreadExecutor(); + private final ExecutorService myExecutorService = Executors.newSingleThreadExecutor(ConcurrencyUtil.newNamedThreadFactory("Python async table")); private LoadingCache, ListenableFuture> myChunkCache = CacheBuilder.newBuilder().build( diff --git a/python/testSrc/com/jetbrains/env/python/console/PyConsoleTask.java b/python/testSrc/com/jetbrains/env/python/console/PyConsoleTask.java index 24c1bc4bdf32..ee81d63311f4 100644 --- a/python/testSrc/com/jetbrains/env/python/console/PyConsoleTask.java +++ b/python/testSrc/com/jetbrains/env/python/console/PyConsoleTask.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.jetbrains.env.python.console; import com.google.common.collect.Lists; @@ -284,7 +299,7 @@ public class PyConsoleTask extends PyExecutionFixtureTestTask { public void run() { doJob(); } - }); + },"py console printer"); myThread.setDaemon(true); myThread.start(); } diff --git a/python/testSrc/com/jetbrains/env/python/debug/PyBaseDebuggerTask.java b/python/testSrc/com/jetbrains/env/python/debug/PyBaseDebuggerTask.java index d10de6c2c987..53b8ee442fd8 100644 --- a/python/testSrc/com/jetbrains/env/python/debug/PyBaseDebuggerTask.java +++ b/python/testSrc/com/jetbrains/env/python/debug/PyBaseDebuggerTask.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.jetbrains.env.python.debug; import com.google.common.collect.Sets; @@ -345,7 +360,7 @@ public abstract class PyBaseDebuggerTask extends PyExecutionFixtureTestTask { public void run() { doJob(); } - }); + },"py debugger job"); myThread.setDaemon(true); myThread.start(); } diff --git a/updater/src/com/intellij/updater/SwingUpdaterUI.java b/updater/src/com/intellij/updater/SwingUpdaterUI.java index 88f8ff96fc73..0b8250387b75 100644 --- a/updater/src/com/intellij/updater/SwingUpdaterUI.java +++ b/updater/src/com/intellij/updater/SwingUpdaterUI.java @@ -164,7 +164,7 @@ public class SwingUpdaterUI implements UpdaterUI { }); } } - }).start(); + },"swing updater dispatch").start(); } private void doCancel() { @@ -210,7 +210,7 @@ public class SwingUpdaterUI implements UpdaterUI { } } } - }).start(); + },"swing updater").start(); } private void exit() { diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java index 298b0c8122e0..c625a6a2070a 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,7 +117,7 @@ public class DomConcurrencyStressTest extends DomTestCase { final CountDownLatch reads = new CountDownLatch(8); for (int j = 0; j < 8; j++) { - new Thread(){ + new Thread("dom concurrency"){ @Override public void run() { try {