From 5bf826ebf0e7a3d834dae7647828638aca4aec29 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 5 Mar 2012 20:26:52 +0400 Subject: [PATCH] cleanup --- .../intellij/execution/process/OSProcessHandler.java | 1 - .../intellij/util/ui/update/MergingUpdateQueue.java | 10 ++++++++-- .../execution/process/BaseOSProcessHandler.java | 12 ++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java b/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java index 7753c3a83499..d5fdce4b7fdc 100644 --- a/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java +++ b/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java @@ -68,7 +68,6 @@ public class OSProcessHandler extends BaseOSProcessHandler { /** * Kill whole process tree. * @param process Process - * @param forceKill If failed to kill process tree - try to kill it using Java API * @return True if process tree has been successfully killed. */ protected boolean killProcessTree(final Process process) { diff --git a/platform/platform-api/src/com/intellij/util/ui/update/MergingUpdateQueue.java b/platform/platform-api/src/com/intellij/util/ui/update/MergingUpdateQueue.java index 0dd329414613..5f566400c3d6 100644 --- a/platform/platform-api/src/com/intellij/util/ui/update/MergingUpdateQueue.java +++ b/platform/platform-api/src/com/intellij/util/ui/update/MergingUpdateQueue.java @@ -46,10 +46,10 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable { private volatile boolean myFlushing; - private String myName; + private final String myName; private int myMergingTimeSpan; private JComponent myModalityStateComponent; - private boolean myExecuteInDispatchThread; + private final boolean myExecuteInDispatchThread; private boolean myPassThrough; private boolean myDisposed; @@ -163,6 +163,7 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable { restartTimer(); } + @Override public void hideNotify() { if (!myActive) { return; @@ -175,6 +176,7 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable { clearWaiter(); } + @Override public void showNotify() { if (myActive) { return; @@ -202,6 +204,7 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable { } } + @Override public void run() { if (mySuspended) return; flush(); @@ -227,6 +230,7 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable { myFlushing = true; final Runnable toRun = new Runnable() { + @Override public void run() { try { final Update[] all; @@ -289,6 +293,7 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable { if (each.executeInWriteAction()) { ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { execute(each); } @@ -381,6 +386,7 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable { return myActive; } + @Override public void dispose() { myDisposed = true; myActive = false; diff --git a/platform/util/src/com/intellij/execution/process/BaseOSProcessHandler.java b/platform/util/src/com/intellij/execution/process/BaseOSProcessHandler.java index 4612ff03698a..9788ea6e3873 100644 --- a/platform/util/src/com/intellij/execution/process/BaseOSProcessHandler.java +++ b/platform/util/src/com/intellij/execution/process/BaseOSProcessHandler.java @@ -51,19 +51,23 @@ public class BaseOSProcessHandler extends ProcessHandler { return ExecutorServiceHolder.ourThreadExecutorsService.submit(task); } + @NotNull public Process getProcess() { return myProcess; } + @Override public void startNotify() { if (myCommandLine != null) { notifyTextAvailable(myCommandLine + '\n', ProcessOutputTypes.SYSTEM); } addProcessListener(new ProcessAdapter() { + @Override public void startNotified(final ProcessEvent event) { try { final OutputReader stdoutReader = new OutputReader(createProcessOutReader()) { + @Override protected void onTextAvailable(@NotNull String text) { notifyTextAvailable(text, ProcessOutputTypes.STDOUT); } @@ -75,6 +79,7 @@ public class BaseOSProcessHandler extends ProcessHandler { }; final OutputReader stderrReader = new OutputReader(createProcessErrReader()) { + @Override protected void onTextAvailable(@NotNull String text) { notifyTextAvailable(text, ProcessOutputTypes.STDERR); } @@ -135,6 +140,7 @@ public class BaseOSProcessHandler extends ProcessHandler { return new InputStreamReader(streamToRead, charset); } + @Override protected void destroyProcessImpl() { try { closeStreams(); @@ -148,8 +154,10 @@ public class BaseOSProcessHandler extends ProcessHandler { getProcess().destroy(); } + @Override protected void detachProcessImpl() { final Runnable runnable = new Runnable() { + @Override public void run() { closeStreams(); @@ -170,10 +178,12 @@ public class BaseOSProcessHandler extends ProcessHandler { } } + @Override public boolean detachIsDefault() { return false; } + @Override public OutputStream getProcessInput() { return myProcess.getOutputStream(); } @@ -194,6 +204,7 @@ public class BaseOSProcessHandler extends ProcessHandler { private static ThreadPoolExecutor createServiceImpl() { return new ThreadPoolExecutor(10, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue(), new ThreadFactory() { + @Override @SuppressWarnings({"HardCodedStringLiteral"}) public Thread newThread(Runnable r) { return new Thread(r, "OSProcessHandler pooled thread"); @@ -213,6 +224,7 @@ public class BaseOSProcessHandler extends ProcessHandler { public ProcessWaitFor(final Process process) { myWaitForThreadFuture = executeOnPooledThread(new Runnable() { + @Override public void run() { int exitCode = 0; try {