Invalid thread access [message #424840] |
Thu, 06 November 2008 10:29  |
Eclipse User |
|
|
|
Hi,
I'm currently working on progress monitoring (over the network) for
committing CDO transactions. Basically it's working pretty well but at
te end of the chain a single problem occurs. The IProgressMonitor passed
from the generated editor on doSave() is an
org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor. When I call
its methods (like isCanceled) from a different thread the following happens:
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:3777)
at org.eclipse.swt.SWT.error(SWT.java:3695)
at org.eclipse.swt.SWT.error(SWT.java:3666)
at org.eclipse.swt.widgets.Display.error(Display.java:1183)
at org.eclipse.swt.widgets.Display.checkDevice(Display.java:706 )
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3437)
at
org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.run EventLoop(EventLoopProgressMonitor.java:123)
at
org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.isC anceled(EventLoopProgressMonitor.java:97)
at
org.eclipse.emf.internal.cdo.protocol.CommitTransactionReque st$1.isCanceled(CommitTransactionRequest.java:72)
at
org.eclipse.net4j.signal.RequestWithConfirmation$1.run(Reque stWithConfirmation.java:162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Inside my framework I have no dependency on UI stuff so, even if I would
like to, I can not call Display.getCurrent().syncExec(). I even don't
know if that would help.
Does anybody have an idea what to do?
Should I wrap the progress monitor already in the editor?
Are there already monitor implementations that do this?
Cheers
/Eike
----
http://thegordian.blogspot.com
|
|
|
|
Re: Invalid thread access [message #424844 is a reply to message #424843] |
Thu, 06 November 2008 10:56  |
Eclipse User |
|
|
|
Tristan,
Thx for your answer. But I found the problem already: I just used the
wrong progress monitor: The one from doSave and not the one passed down
from the ProgressMonitorDialog ;-(
Cheers
/Eike
----
http://thegordian.blogspot.com
> Hi,
> maybe I will not be a great helper and my solution a little evident
> but why don't you define observers (java embedded or custom) on your
> transaction ?
>
> if a local progress monitor is registered he can uses the
> Display.getCurrent().syncExec() And your code you just notify the
> observers
>
> Eike Stepper a écrit :
>> Hi,
>>
>> I'm currently working on progress monitoring (over the network) for
>> committing CDO transactions. Basically it's working pretty well but
>> at te end of the chain a single problem occurs. The IProgressMonitor
>> passed from the generated editor on doSave() is an
>> org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor. When I call
>> its methods (like isCanceled) from a different thread the following
>> happens:
>>
>> org.eclipse.swt.SWTException: Invalid thread access
>> at org.eclipse.swt.SWT.error(SWT.java:3777)
>> at org.eclipse.swt.SWT.error(SWT.java:3695)
>> at org.eclipse.swt.SWT.error(SWT.java:3666)
>> at org.eclipse.swt.widgets.Display.error(Display.java:1183)
>> at org.eclipse.swt.widgets.Display.checkDevice(Display.java:706 )
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3437)
>> at
>> org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.run EventLoop(EventLoopProgressMonitor.java:123)
>>
>> at
>> org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.isC anceled(EventLoopProgressMonitor.java:97)
>>
>> at
>> org.eclipse.emf.internal.cdo.protocol.CommitTransactionReque st$1.isCanceled(CommitTransactionRequest.java:72)
>>
>> at
>> org.eclipse.net4j.signal.RequestWithConfirmation$1.run(Reque stWithConfirmation.java:162)
>>
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:650)
>>
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:675)
>>
>> at java.lang.Thread.run(Thread.java:595)
>>
>> Inside my framework I have no dependency on UI stuff so, even if I
>> would like to, I can not call Display.getCurrent().syncExec(). I even
>> don't know if that would help.
>>
>> Does anybody have an idea what to do?
>> Should I wrap the progress monitor already in the editor?
>> Are there already monitor implementations that do this?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>>
|
|
|
Powered by
FUDForum. Page generated in 0.04144 seconds