Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357886

Summary: When adding more than one OutputListener in hostshell, IllegalThreadStateException is thrown
Product: [Tools] Target Management Reporter: Yufen Kuo <ykuo>
Component: RSEAssignee: dsdp.tm.rse-inbox <tm.rse-inbox>
Status: NEW --- QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:

Description Yufen Kuo CLA 2011-09-15 17:22:22 EDT
Build Identifier: I20110613-1736

If in the code, more than one output listener is added to hostshell (hostShell.addOutputListener), you would get  java.lang.IllegalThreadStateException.

It seems in standard error's AbstractHostShellOutputReader, it does
not return the correct value for isAlive(). When the thread is already started,
isAlive() still returns false and which results :

java.lang.IllegalThreadStateException
    at java.lang.Thread.start(Thread.java:638)
    at
org.eclipse.rse.services.shells.AbstractHostShellOutputReader.startIfNotAlive(AbstractHostShellOutputReader.java:111)
    at
org.eclipse.rse.services.shells.AbstractHostShellOutputReader.addOutputListener(AbstractHostShellOutputReader.java:140)
    at
org.eclipse.rse.services.shells.HostShellProcessAdapter.<init>(HostShellProcessAdapter.java:59)
    at
org.eclipse.rse.internal.subsystems.processes.shell.linux.LinuxShellProcessService.listAllProcesses(LinuxShellProcessService.java:142)
    at
org.eclipse.rse.subsystems.processes.servicesubsystem.ProcessServiceSubSystem.listAllProcesses(ProcessServiceSubSystem.java:134)
    at
org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl.internalResolveFilterString(RemoteProcessSubSystemImpl.java:140)
    at
org.eclipse.rse.core.subsystems.SubSystem.internalResolveFilterStrings(SubSystem.java:2924)
    at
org.eclipse.rse.core.subsystems.SubSystem.resolveFilterStrings(SubSystem.java:2300)
    at
org.eclipse.rse.internal.ui.view.SystemViewFilterReferenceAdapter.internalGetChildren(SystemViewFilterReferenceAdapter.java:466)
    at
org.eclipse.rse.internal.ui.view.SystemViewFilterReferenceAdapter.getChildren(SystemViewFilterReferenceAdapter.java:284)
    at
org.eclipse.rse.internal.ui.view.SystemViewFilterReferenceAdapter.getChildren(SystemViewFilterReferenceAdapter.java:292)
    at
org.eclipse.rse.ui.operations.SystemFetchOperation.execute(SystemFetchOperation.java:441)
    at
org.eclipse.rse.ui.operations.SystemFetchOperation.run(SystemFetchOperation.java:182)
    at
org.eclipse.rse.ui.view.AbstractSystemViewAdapter.fetchDeferredChildren(AbstractSystemViewAdapter.java:2290)
    at
org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Reproducible: Always