Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 187606 Details for
Bug 335415
[backport] TerminalServiceShellOutputReader logs error when hostShell.exit() is called
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
terminalLoggingFix.diff.txt (text/plain), 7.62 KB, created by
Martin Oberhuber
on 2011-01-25 21:49:39 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Martin Oberhuber
Created:
2011-01-25 21:49:39 EST
Size:
7.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.services >Index: src/org/eclipse/rse/internal/services/shells/TerminalServiceHostShell.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/internal/services/shells/TerminalServiceHostShell.java,v >retrieving revision 1.3 >diff -u -r1.3 TerminalServiceHostShell.java >--- src/org/eclipse/rse/internal/services/shells/TerminalServiceHostShell.java 14 Dec 2008 18:28:53 -0000 1.3 >+++ src/org/eclipse/rse/internal/services/shells/TerminalServiceHostShell.java 26 Jan 2011 02:49:14 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2008 IBM Corporation and others. >+ * Copyright (c) 2006, 2011 IBM Corporation 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 >@@ -20,6 +20,7 @@ > * Anna Dushistova (MontaVista) - adapted from SshHostShell > * Anna Dushistova (MontaVista) - [240523] [rseterminals] Provide a generic adapter factory that adapts any ITerminalService to an IShellService > * Anna Dushistova (MontaVista) - [258720] SshHostShell fails to run command if initialWorkingDirectory supplied >+ * Rob Stryker (JBoss) - [335059] TerminalServiceShellOutputReader logs error when hostShell.exit() is called > *******************************************************************************/ > > package org.eclipse.rse.internal.services.shells; >@@ -119,6 +120,12 @@ > if (fShellWriter != null) { > fShellWriter.stopThread(); > } >+ if( fStderrHandler != null ) { >+ fStderrHandler.stopThread(); >+ } >+ if( fStdoutHandler!= null ) { >+ fStdoutHandler.stopThread(); >+ } > fTerminalShell.exit(); > } > >Index: src/org/eclipse/rse/internal/services/shells/TerminalServiceShellOutputReader.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/internal/services/shells/TerminalServiceShellOutputReader.java,v >retrieving revision 1.1 >diff -u -r1.1 TerminalServiceShellOutputReader.java >--- src/org/eclipse/rse/internal/services/shells/TerminalServiceShellOutputReader.java 4 Dec 2008 22:19:52 -0000 1.1 >+++ src/org/eclipse/rse/internal/services/shells/TerminalServiceShellOutputReader.java 26 Jan 2011 02:49:14 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2008 IBM Corporation and others. >+ * Copyright (c) 2006, 2011 IBM Corporation 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 >@@ -16,6 +16,7 @@ > * Martin Oberhuber (Wind River) - Added vt100 escape sequence ignoring. > * Anna Dushistova (MontaVista) - adapted from SshShellOutputReader > * Anna Dushistova (MontaVista) - [240523] [rseterminals] Provide a generic adapter factory that adapts any ITerminalService to an IShellService >+ * Rob Stryker (JBoss) - [335059] TerminalServiceShellOutputReader logs error when hostShell.exit() is called > *******************************************************************************/ > > package org.eclipse.rse.internal.services.shells; >@@ -35,6 +36,8 @@ > public class TerminalServiceShellOutputReader extends > AbstractHostShellOutputReader { > protected BufferedReader fReader; >+ private volatile Thread fReaderThread = null; >+ private volatile boolean isCanceled = false; > private String fPromptChars = ">$%#]"; //Characters we accept as the end of a prompt //$NON-NLS-1$; > > public TerminalServiceShellOutputReader(IHostShell hostShell, >@@ -50,12 +53,21 @@ > //TODO Check if ssh supports some method of having separate stdout and stderr streams > return null; > } >+ fReaderThread = Thread.currentThread(); >+ try { >+ return interruptableReadLine(); >+ } finally { >+ fReaderThread = null; >+ } >+ } >+ >+ private IHostOutput interruptableReadLine() { > StringBuffer theLine = new StringBuffer(); > StringBuffer theDebugLine = null; > theDebugLine = new StringBuffer(); > int ch; > boolean done = false; >- while (!done && !isFinished()) { >+ while (!done && !isFinished() && !isCanceled) { > try { > ch = fReader.read(); > switch (ch) { >@@ -125,9 +137,10 @@ > if (len>=0 && fPromptChars.indexOf(theLine.charAt(len))>=0) { > waitIncrement = 5; //wait only 5 msec if we think it's a prompt > } >- try { >- Thread.sleep(waitIncrement); >- } catch (InterruptedException e) { >+ if (!isCanceled) { >+ try { >+ Thread.sleep(waitIncrement); >+ } catch (InterruptedException e) { /*ignore*/ } > } > if (!fReader.ready()) { > done = true; >@@ -137,7 +150,10 @@ > //FIXME it's dangerous to return null here since this will end > //our reader thread completely... the exception could just be > //temporary, and we should keep running! >- Activator.getDefault().logException(e); >+ if( !this.isCanceled ) { >+ /* 335059: Don't log IOException on close due to cancellation */ >+ Activator.getDefault().logException(e); >+ } > return null; > } > } >@@ -147,4 +163,15 @@ > } > return new SimpleHostOutput(theLine.toString()); > } >+ >+ /** >+ * Stop the reader Thread, forcing internalReadLine() to return. >+ * Does not close the Stream. >+ */ >+ public void stopThread() { >+ this.isCanceled = true; >+ if (fReaderThread != null) { >+ fReaderThread.interrupt(); >+ } >+ } > } >Index: src/org/eclipse/rse/internal/services/shells/TerminalServiceShellWriterThread.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/internal/services/shells/TerminalServiceShellWriterThread.java,v >retrieving revision 1.2 >diff -u -r1.2 TerminalServiceShellWriterThread.java >--- src/org/eclipse/rse/internal/services/shells/TerminalServiceShellWriterThread.java 19 Dec 2008 14:37:58 -0000 1.2 >+++ src/org/eclipse/rse/internal/services/shells/TerminalServiceShellWriterThread.java 26 Jan 2011 02:49:14 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. >+ * Copyright (c) 2006, 2011 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 >@@ -9,6 +9,7 @@ > * Martin Oberhuber (Wind River) - initial API and implementation > * Anna Dushistova (MontaVista) - adapted from SshShellWriterThread > * Anna Dushistova (MontaVista) - [240523] [rseterminals] Provide a generic adapter factory that adapts any ITerminalService to an IShellService >+ * Rob Stryker (JBoss) - [335059] TerminalServiceShellOutputReader logs error when hostShell.exit() is called > *******************************************************************************/ > package org.eclipse.rse.internal.services.shells; > >@@ -20,7 +21,7 @@ > public class TerminalServiceShellWriterThread extends Thread { > private PrintWriter fOutputWriter; > private String fNextCommand; >- private boolean fIsCancelled; >+ private volatile boolean fIsCancelled; > > /** > * constructor for terminal service shell writer thread
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 335415
: 187606