From 9fd5e0d9ebb69a5ebadf2bef13cfda9dd8ef1f9b Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Thu, 27 Mar 2008 16:57:01 +0000 Subject: [PATCH] Preliminary solution for Bug 223154. We increase the size of PipedInputBuffer from 1K to 1M but using LargePipedInputBuffer --- .../service/command/AbstractCLIProcess.java | 5 +++-- .../command/LargePipedInputStream.java | 19 +++++++++++++++++++ .../mi/service/command/MIInferiorProcess.java | 6 ++++-- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/LargePipedInputStream.java diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/AbstractCLIProcess.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/AbstractCLIProcess.java index c4fd26db62c..1fe0c72b4d7 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/AbstractCLIProcess.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/AbstractCLIProcess.java @@ -101,10 +101,11 @@ public abstract class AbstractCLIProcess extends Process PipedOutputStream miOutLogPipe = null; try { + // Using a LargePipedInputStream see https://bugs.eclipse.org/bugs/show_bug.cgi?id=223154 miOutConsolePipe = new PipedOutputStream(); - miInConsolePipe = new PipedInputStream(miOutConsolePipe); + miInConsolePipe = new LargePipedInputStream(miOutConsolePipe); miOutLogPipe = new PipedOutputStream(); - miInLogPipe = new PipedInputStream(miOutLogPipe); + miInLogPipe = new LargePipedInputStream(miOutLogPipe); } catch (IOException e) { ILog log = MIPlugin.getDefault().getLog(); if (log != null) { diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/LargePipedInputStream.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/LargePipedInputStream.java new file mode 100644 index 00000000000..91b6d4be2f1 --- /dev/null +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/LargePipedInputStream.java @@ -0,0 +1,19 @@ +package org.eclipse.dd.mi.service.command; + +import java.io.IOException; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; + + +class LargePipedInputStream extends PipedInputStream { + + private final int LARGE_BUF_SIZE = 1024 * 1024; // 1 megs + + public LargePipedInputStream(PipedOutputStream pipedoutputstream) + throws IOException + { + super(pipedoutputstream); + buffer = new byte[LARGE_BUF_SIZE]; + } + +} diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/MIInferiorProcess.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/MIInferiorProcess.java index b8ef43d869c..8455061d919 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/MIInferiorProcess.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/MIInferiorProcess.java @@ -138,7 +138,8 @@ public class MIInferiorProcess extends Process fInputStreamPiped = new PipedOutputStream(); PipedInputStream inputStream = null; try { - inputStream = new PipedInputStream(fInputStreamPiped); + // Using a LargePipedInputStream see https://bugs.eclipse.org/bugs/show_bug.cgi?id=223154 + inputStream = new LargePipedInputStream(fInputStreamPiped); } catch (IOException e) { } fInputStream = inputStream; @@ -150,7 +151,8 @@ public class MIInferiorProcess extends Process fErrorStreamPiped = new PipedOutputStream(); PipedInputStream errorStream = null; try { - errorStream = new PipedInputStream(fErrorStreamPiped); + // Using a LargePipedInputStream see https://bugs.eclipse.org/bugs/show_bug.cgi?id=223154 + errorStream = new LargePipedInputStream(fErrorStreamPiped); } catch (IOException e) { } fErrorStream = errorStream;