Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [dsdp-tm-dev] IllegalStateException

Hi,
 
looks like you've been trying to add shell output readers from multiple threads
at the same time. Attached patch should fix the issue, although I did not
analyze the matter very deeply so you might fall into other issues due to
thread concurrency now.
 
Please file a bug in bugzilla so we can track this.
 
Thanks,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm
 
 


From: dsdp-tm-dev-bounces@xxxxxxxxxxx [mailto:dsdp-tm-dev-bounces@xxxxxxxxxxx] On Behalf Of Sheldon Dsouza
Sent: Donnerstag, 31. Jänner 2008 17:37
To: Target Management developer discussions
Subject: Re: [dsdp-tm-dev] IllegalStateException

Hi Martin,

   I have attached the traceback

java.lang.IllegalThreadStateException
    at java.lang.Thread.start(Thread.java:571)
    at org.eclipse.rse.services.shells.AbstractHostShellOutputReader.addOutputListener(AbstractHostShellOutputReader.java:131)
    at org.eclipse.rse.services.shells.HostShellProcessAdapter.<init>(HostShellProcessAdapter.java:57)
    at com.celunite.rad.nativecommunicator.server.QemuUtil$1.run(QemuUtil.java:55)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3814)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3434)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
    at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1148)


On Jan 31, 2008 8:53 PM, Oberhuber, Martin <Martin.Oberhuber@xxxxxxxxxxxxx> wrote:
Sheldon,
 
you'll need to send the traceback from your exception.
Without that, nobody will be able to help.
 
Cheers,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
 
 


From: dsdp-tm-dev-bounces@xxxxxxxxxxx [mailto:dsdp-tm-dev-bounces@xxxxxxxxxxx] On Behalf Of Sheldon Dsouza
Sent: Donnerstag, 31. Jänner 2008 16:19
To: Target Management developer discussions
Subject: [dsdp-tm-dev] IllegalStateException

Hi,

      We launch a telnet session using the RSE API, now the shell that is obtained from the connection is stored in a singleton class. We are doing this so that we can write to the same shell throughout the telnet session without creating a new shell everytime.

We are getting an IllegalThreadStateException while writing to the shell multiple times. Trying to figure out why is this happening even if the shell is active, any inputs thanks


Regards,
Sheldon

_______________________________________________
dsdp-tm-dev mailing list
dsdp-tm-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dsdp-tm-dev


### Eclipse Workspace Patch 1.0
#P org.eclipse.rse.services
Index: src/org/eclipse/rse/services/shells/AbstractHostShellOutputReader.java
===================================================================
RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/shells/AbstractHostShellOutputReader.java,v
retrieving revision 1.7
diff -u -r1.7 AbstractHostShellOutputReader.java
--- src/org/eclipse/rse/services/shells/AbstractHostShellOutputReader.java	3 Aug 2007 14:32:52 -0000	1.7
+++ src/org/eclipse/rse/services/shells/AbstractHostShellOutputReader.java	31 Jan 2008 17:10:33 -0000
@@ -18,6 +18,7 @@
 package org.eclipse.rse.services.shells;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 public abstract class AbstractHostShellOutputReader  extends Thread implements IHostShellOutputReader
@@ -38,7 +39,7 @@
 	public AbstractHostShellOutputReader(IHostShell hostShell, boolean isErrorReader)
 	{
 		_hostShell = hostShell;
-		_listeners = new ArrayList();
+		_listeners = Collections.synchronizedList(new ArrayList());
 		_linesOfOutput = new ArrayList();
 		_consumerOffset = 0;
 		_isErrorReader = isErrorReader;
@@ -102,12 +103,18 @@
 		}
 	}
 	
+	protected final synchronized void startIfNotAlive() {
+		if (!isAlive()) {
+			start();
+		}
+	}
+	
 	public IHostOutput readLine()
 	{
 		if (!isAlive())
 		{
 			internalReadLine();
-			start();			
+			startIfNotAlive();			
 		}
 		return (IHostOutput)_linesOfOutput.get(_consumerOffset++);		
 	}
@@ -126,10 +133,7 @@
 	public void addOutputListener(IHostShellOutputListener listener)
 	{
 		_listeners.add(listener);
-		if (!isAlive())
-		{
-			start();
-		}
+		startIfNotAlive();
 	}
 
 	public void fireOutputChanged(IHostShellChangeEvent event)

Back to the top