Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Kubitz2022-02-18 22:18:25 +0000
committerSarika Sinha2022-03-22 13:28:17 +0000
commitbd873c6f54dac0ed843c3e327c37f3af85971eb0 (patch)
treea0f927b1d933747393b5e11ac46577d3e6e8bfc1
parent616250ab898823a1366f9e9b5e0b77b529099775 (diff)
downloadeclipse.platform.debug-I20220323-1230.tar.gz
eclipse.platform.debug-I20220323-1230.tar.xz
eclipse.platform.debug-I20220323-1230.zip
and launch config name. Change-Id: I9f1fb52024be04982c21373e9ad258267bd2ded4 Signed-off-by: Joerg Kubitz <jkubitz-eclipse@gmx.de> Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.debug/+/190971 Tested-by: Platform Bot <platform-bot@eclipse.org> Reviewed-by: Sarika Sinha <sarika.sinha@in.ibm.com>
-rw-r--r--org.eclipse.debug.core/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java24
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java10
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java6
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java11
-rw-r--r--org.eclipse.debug.tests/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.tests/pom.xml2
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/InputStreamMonitorTests.java8
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/OutputStreamMonitorTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/StreamsProxyTests.java2
12 files changed, 47 insertions, 27 deletions
diff --git a/org.eclipse.debug.core/META-INF/MANIFEST.MF b/org.eclipse.debug.core/META-INF/MANIFEST.MF
index 9c1ea447d..60eb6d1db 100644
--- a/org.eclipse.debug.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true
-Bundle-Version: 3.19.0.qualifier
+Bundle-Version: 3.19.100.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.debug.core.DebugPlugin
Bundle-Vendor: %providerName
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java
index 193458fea..62a4e6c5b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java
@@ -107,6 +107,8 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
*/
private boolean fTerminateDescendants = true;
+ private final String fThreadNameSuffix;
+
/**
* Constructs a RuntimeProcess on the given system process
* with the given name, adding this process to the given
@@ -146,14 +148,26 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
} catch (CoreException e) {
DebugPlugin.log(e);
}
+ fThreadNameSuffix = getPidInfo(process, launch);
fStreamsProxy = createStreamsProxy();
- fMonitor = new ProcessMonitorThread();
+ fMonitor = new ProcessMonitorThread(fThreadNameSuffix);
fMonitor.start();
launch.addProcess(this);
fireCreationEvent();
}
+ private static String getPidInfo(Process process, ILaunch launch) {
+ String pid;
+ ILaunchConfiguration lc = launch == null ? null : launch.getLaunchConfiguration();
+ String name = lc == null ? "" : " " + lc.getName(); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ pid = " for PID " + process.pid(); //$NON-NLS-1$
+ } catch (Exception e) {
+ pid = ""; //$NON-NLS-1$
+ }
+ return pid + name;
+ }
/**
* Initialize the attributes of this process to those in the given map.
*
@@ -355,7 +369,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
DebugPlugin.log(e);
}
}
- return new StreamsProxy(getSystemProcess(), charset);
+ return new StreamsProxy(getSystemProcess(), charset, fThreadNameSuffix);
}
/**
@@ -488,9 +502,11 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* Creates a new process monitor and starts monitoring the process for
* termination.
+ *
+ * @param suffix Thread name suffix
*/
- private ProcessMonitorThread() {
- super(DebugCoreMessages.ProcessMonitorJob_0);
+ private ProcessMonitorThread(String suffix) {
+ super(DebugCoreMessages.ProcessMonitorJob_0 + suffix);
setDaemon(true);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
index d38a64f67..d17d3fcd5 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
@@ -89,7 +89,6 @@ public class DebugCoreMessages extends NLS {
public static String LogicalStructureProvider_1;
public static String LogicalStructureType_1;
public static String SystemPropertyResolver_0;
- public static String InputStreamMonitor_label;
public static String Launch_terminate_failed;
public static String LaunchConfiguration_Failed_to_delete_launch_configuration__1;
public static String LaunchConfigurationDelegate_6;
@@ -115,7 +114,6 @@ public class DebugCoreMessages extends NLS {
public static String LaunchManager_invalid_config_name_char;
public static String LaunchManager_Source_locator_does_not_exist___0__13;
public static String LogicalStructureType_0;
- public static String OutputStreamMonitor_label;
public static String ProcessMonitorJob_0;
public static String RuntimeProcess_terminate_failed;
public static String RuntimeProcess_Exit_value_not_available_until_process_terminates__1;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
index eae7e6de4..70ee71cf0 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
@@ -44,7 +44,6 @@ GroupLaunchConfigurationDelegate_Waiting_for_termination=Waiting for termination
GroupLaunchElement_inherit_launch_mode_label=Inherit
GroupLaunchElement_outputRegexp=Wait for console output (regexp)
SystemPropertyResolver_0=System property not specified
-InputStreamMonitor_label=Input Stream Monitor
Launch_terminate_failed=Terminate failed
LaunchConfiguration_Failed_to_delete_launch_configuration__1=Failed to delete launch configuration.
LaunchConfiguration_9=Preparing launch delegate...
@@ -114,7 +113,6 @@ LogicalStructureType_0=<Missing Description>
LogicalStructureType_1=Required attribute {0} missing for logicalStructureType extension.
LogicalStructureProvider_0=Required attribute modelIdentifier missing for logicalStructureType extension.
LogicalStructureProvider_1=Required attribute class missing for logicalStructureType extension.
-OutputStreamMonitor_label=Output Stream Monitor
ProcessMonitorJob_0=Process monitor
RuntimeProcess_terminate_failed=Terminate failed
RuntimeProcess_Exit_value_not_available_until_process_terminates__1=Exit value not available until process terminates.
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
index d0525f642..eacd9e3cb 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
@@ -127,13 +127,19 @@ public class InputStreamMonitor {
}
}
+ public void startMonitoring() {
+ startMonitoring("Input Stream Monitor"); //$NON-NLS-1$
+ }
+
/**
* Starts a thread which writes the stream.
+ *
+ * @param threadName Thread name
*/
- public void startMonitoring() {
+ public void startMonitoring(String threadName) {
synchronized (this) {
if (fThread == null) {
- fThread = new Thread((Runnable) this::write, DebugCoreMessages.InputStreamMonitor_label);
+ fThread = new Thread((Runnable) this::write, threadName);
fThread.setDaemon(true);
fThread.start();
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
index 3a6f1a41c..fb09bc6ad 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
@@ -308,12 +308,14 @@ public class OutputStreamMonitor implements IBinaryStreamMonitor {
/**
* Starts a thread which reads from the stream
+ *
+ * @param name Thread name
*/
- protected void startMonitoring() {
+ protected void startMonitoring(String name) {
synchronized (this) {
if (fThread == null) {
fDone.set(false);
- fThread = new Thread((Runnable) this::read, DebugCoreMessages.OutputStreamMonitor_label);
+ fThread = new Thread((Runnable) this::read, name);
fThread.setDaemon(true);
fThread.setPriority(Thread.MIN_PRIORITY);
fThread.start();
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
index 0f14b7d1a..3996d9546 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
@@ -55,18 +55,19 @@ public class StreamsProxy implements IBinaryStreamsProxy {
*
* @param process system process to create a streams proxy on
* @param charset the process's charset or <code>null</code> if default
+ * @param suffix Thread name suffix
*/
@SuppressWarnings("resource")
- public StreamsProxy(Process process, Charset charset) {
+ public StreamsProxy(Process process, Charset charset, String suffix) {
if (process == null) {
return;
}
fOutputMonitor = new OutputStreamMonitor(process.getInputStream(), charset);
fErrorMonitor = new OutputStreamMonitor(process.getErrorStream(), charset);
fInputMonitor = new InputStreamMonitor(process.getOutputStream(), charset);
- fOutputMonitor.startMonitoring();
- fErrorMonitor.startMonitoring();
- fInputMonitor.startMonitoring();
+ fOutputMonitor.startMonitoring("Output Stream Monitor" + suffix); //$NON-NLS-1$
+ fErrorMonitor.startMonitoring("Error Stream Monitor" + suffix); //$NON-NLS-1$
+ fInputMonitor.startMonitoring("Input Stream Monitor" + suffix); //$NON-NLS-1$
}
/**
@@ -83,7 +84,7 @@ public class StreamsProxy implements IBinaryStreamsProxy {
// but Bug 562653 brought up a client which use this internal class via
// reflection and breaks without this constructor. So we restored the
// old constructor for the time being.
- this(process, Charset.forName(encoding));
+ this(process, Charset.forName(encoding), ""); //$NON-NLS-1$
}
/**
diff --git a/org.eclipse.debug.tests/META-INF/MANIFEST.MF b/org.eclipse.debug.tests/META-INF/MANIFEST.MF
index 659b8de4d..1dffc2bae 100644
--- a/org.eclipse.debug.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.tests;singleton:=true
-Bundle-Version: 3.12.600.qualifier
+Bundle-Version: 3.12.700.qualifier
Bundle-Activator: org.eclipse.debug.tests.TestsPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
diff --git a/org.eclipse.debug.tests/pom.xml b/org.eclipse.debug.tests/pom.xml
index 02eb2f060..c55bdbc41 100644
--- a/org.eclipse.debug.tests/pom.xml
+++ b/org.eclipse.debug.tests/pom.xml
@@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.debug</groupId>
<artifactId>org.eclipse.debug.tests</artifactId>
- <version>3.12.600-SNAPSHOT</version>
+ <version>3.12.700-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<code.ignoredWarnings>${tests.ignoredWarnings}</code.ignoredWarnings>
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/InputStreamMonitorTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/InputStreamMonitorTests.java
index 361995c89..45f77569d 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/InputStreamMonitorTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/InputStreamMonitorTests.java
@@ -25,7 +25,6 @@ import java.util.Set;
import java.util.function.Supplier;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.internal.core.DebugCoreMessages;
import org.eclipse.debug.internal.core.InputStreamMonitor;
import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.debug.tests.TestUtil;
@@ -96,9 +95,10 @@ public class InputStreamMonitorTests extends AbstractDebugTest {
@Test
@SuppressWarnings("resource")
public void testClose() throws Exception {
+ String threadName = "MAGICtestClose";
Supplier<Long> getInputStreamMonitorThreads = () -> {
Set<Thread> allThreads = Thread.getAllStackTraces().keySet();
- long numMonitorThreads = allThreads.stream().filter(t -> DebugCoreMessages.InputStreamMonitor_label.equals(t.getName())).count();
+ long numMonitorThreads = allThreads.stream().filter(t -> t.getName().contains(threadName)).count();
return numMonitorThreads;
};
long alreadyLeakedThreads = getInputStreamMonitorThreads.get();
@@ -117,7 +117,7 @@ public class InputStreamMonitorTests extends AbstractDebugTest {
{
ClosableTestOutputStream testStream = new ClosableTestOutputStream();
InputStreamMonitor monitor = new InputStreamMonitor(testStream);
- monitor.startMonitoring();
+ monitor.startMonitoring(threadName);
assertEquals("Stream closed to early.", 0, testStream.numClosed);
monitor.close();
TestUtil.waitWhile(() -> testStream.numClosed == 0, 200);
@@ -126,7 +126,7 @@ public class InputStreamMonitorTests extends AbstractDebugTest {
{
ClosableTestOutputStream testStream = new ClosableTestOutputStream();
InputStreamMonitor monitor = new InputStreamMonitor(testStream);
- monitor.startMonitoring();
+ monitor.startMonitoring(threadName);
assertEquals("Stream closed to early.", 0, testStream.numClosed);
monitor.closeInputStream();
monitor.close();
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/OutputStreamMonitorTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/OutputStreamMonitorTests.java
index 0d361021f..523192ae2 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/OutputStreamMonitorTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/OutputStreamMonitorTests.java
@@ -195,9 +195,8 @@ public class OutputStreamMonitorTests extends AbstractDebugTest {
super(stream, charset);
}
- @Override
public void startMonitoring() {
- super.startMonitoring();
+ super.startMonitoring("");
}
@Override
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/StreamsProxyTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/StreamsProxyTests.java
index 71569147a..571da15c6 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/StreamsProxyTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/StreamsProxyTests.java
@@ -66,7 +66,7 @@ public class StreamsProxyTests extends AbstractDebugTest {
final String s = prefix + String.join("", Collections.nCopies(numTwoByteCharacters, "\u00F8"));
final ByteArrayInputStream stdout = new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
final Process mockProcess = new MockProcess(stdout, null, 0);
- final StreamsProxy streamProxy = new StreamsProxy(mockProcess, StandardCharsets.UTF_8);
+ final StreamsProxy streamProxy = new StreamsProxy(mockProcess, StandardCharsets.UTF_8, "");
streamProxy.close();
final String readContent = streamProxy.getOutputStreamMonitor().getContents();
assertEquals("Process output got corrupted.", s, readContent);

Back to the top