From 616c990c24dfa6ed95c4e834497a54ad93ced244 Mon Sep 17 00:00:00 2001 From: Martin Oberhuber < martin.oberhuber@windriver.com> Date: Tue, 15 Mar 2011 00:22:46 +0000 Subject: [PATCH] Revert release of Bug 333613 - [terminal] "Job found still running" message on stdout console after terminating Eclipse --- .../org.eclipse.tm.releng/maps/terminal.map | 2 +- .../emulator/VT100TerminalControl.java | 39 +++++++------------ .../terminal/textcanvas/PipedInputStream.java | 23 ++++------- 3 files changed, 23 insertions(+), 41 deletions(-) diff --git a/releng/org.eclipse.tm.releng/maps/terminal.map b/releng/org.eclipse.tm.releng/maps/terminal.map index bba70136c6d..f71d6c39c48 100644 --- a/releng/org.eclipse.tm.releng/maps/terminal.map +++ b/releng/org.eclipse.tm.releng/maps/terminal.map @@ -7,7 +7,7 @@ feature@org.eclipse.tm.terminal.ssh=v201103142315,:pserver:anonymous:none@dev.ec feature@org.eclipse.tm.terminal.telnet=v201103142315,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/tools,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.telnet-feature feature@org.eclipse.tm.terminal.test=v201103142315,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/tools,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.test-feature feature@org.eclipse.tm.terminal.view=v201103142315,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/tools,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.view-feature -plugin@org.eclipse.tm.terminal=v201103142315,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/tools,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal +plugin@org.eclipse.tm.terminal=v201101251823,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/tools,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal plugin@org.eclipse.tm.terminal.local=v201101042155,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/tools,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.local plugin@org.eclipse.tm.terminal.serial=v201101042155,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/tools,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.serial plugin@org.eclipse.tm.terminal.ssh=v201101042155,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/tools,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.ssh diff --git a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java index b4db0421536..18ff1ffd2b6 100644 --- a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java +++ b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java @@ -26,7 +26,6 @@ * Martin Oberhuber (Wind River) - [240745] Pressing Ctrl+F1 in the Terminal should bring up context help * Michael Scharf (Wind River) - [240098] The cursor should not blink when the terminal is disconnected * Anton Leherbauer (Wind River) - [335021] Middle mouse button copy/paste does not work with the terminal - * Pawel Piech (Wind River) - [333613] Avoid "Job still found running" error after shutdown *******************************************************************************/ package org.eclipse.tm.internal.terminal.emulator; @@ -346,35 +345,27 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC public void disconnectTerminal() { Logger.log("entered."); //$NON-NLS-1$ - //Ensure that a new Job can be started; then clean up old Job. - //TODO not sure whether the fInputStream needs to be cleaned too, - //or whether the Job could actually cancel in case the fInputStream is closed. - Job job; - synchronized(this) { - job = fJob; - fJob = null; - } - if (job!=null) { - job.cancel(); - // Join job to avoid leaving job running after workbench shutdown (333613). - try { - fInputStream.close(); - //There's not really a need to interrupt, since the job will - //check its cancel status after 500 msec latest anyways... - //Thread t = job.getThread(); - //if(t!=null) t.interrupt(); - job.join(); - } catch (IOException e1) { - } catch (InterruptedException e) { - } - } - if (getState()==TerminalState.CLOSED) { return; } if(getTerminalConnector()!=null) { getTerminalConnector().disconnect(); } + //Ensure that a new Job can be started; then clean up old Job. + //TODO not sure whether the fInputStream needs to be cleaned too, + //or whether the Job could actually cancel in case the fInputStream is closed. + Job job; + synchronized(this) { + job = fJob; + fJob = null; + } + if (job!=null) { + job.cancel(); + //There's not really a need to interrupt, since the job will + //check its cancel status after 500 msec latest anyways... + //Thread t = job.getThread(); + //if(t!=null) t.interrupt(); + } } // TODO diff --git a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/PipedInputStream.java b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/PipedInputStream.java index d15a47b5fed..5b36e5a9bb4 100644 --- a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/PipedInputStream.java +++ b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/PipedInputStream.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1996, 2011 Wind River Systems, Inc. and others. + * Copyright (c) 1996, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,7 +10,6 @@ * Douglas Lea (Addison Wesley) - [cq:1552] BoundedBufferWithStateTracking adapted to BoundedByteBuffer * Martin Oberhuber (Wind River) - the waitForAvailable method * Martin Oberhuber (Wind River) - [208166] Avoid unnecessary arraycopy in BoundedByteBuffer - * Pawel Piech (Wind River) - [333613] Avoid "Job still found running" error after shutdown *******************************************************************************/ package org.eclipse.tm.internal.terminal.textcanvas; @@ -73,12 +72,7 @@ public class PipedInputStream extends InputStream { * Must be called with a lock on this! */ public int available() { - if (fUsedSlots > 0) { - return fUsedSlots; - } else if (fClosed) { - return -1; - } - return 0; + return fUsedSlots; } /** * Writes a single byte to the buffer. Blocks if the buffer is full. @@ -243,8 +237,7 @@ public class PipedInputStream extends InputStream { } /** * Must be called in the Display Thread! - * @return number of characters available for reading. Returns -1 if - * stream is closed and no characters are left in pipe. + * @return true if a character is available for the terminal to show. */ public int available() { synchronized(fQueue) { @@ -266,14 +259,12 @@ public class PipedInputStream extends InputStream { } } /** - * Closing a PipedInputStream is the same as closing the output stream. - * The stream will allow reading data that's still in the pipe after which it will - * throw an IOException. + * Closing a PipedInputStream has no effect. The methods in + * this class can be called after the stream has been closed without + * generating an IOException. + *

*/ public void close() throws IOException { - synchronized(fQueue) { - fQueue.close(); - } } public int read(byte[] cbuf, int off, int len) throws IOException {