Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Wait for async
Wait for async [message #479483] Tue, 11 August 2009 10:08 Go to next message
T. Wilhelm is currently offline T. WilhelmFriend
Messages: 129
Registered: July 2009
Senior Member
Hey all,

i have a problem concerning Display.asyncExe(myRunnable); or in detail
with realm.asyncExe(myRunnable).
I have a database and read some data from it in a Job. I registered my
Model at this job as listener, and when the job is done my model gets the
data from the job. Because i have a WritableList i use:

realm.asyncExec(new Runnable() {
@Override
public void run() {
myList.addAll(partnerList);

fireQueryDone();
}
});

Now my model have to update all views. Therefore as you can see i use
observer pattern and call fireQueryDone(). This call i want to do in my
main thread and not in the job thread, so i want to wait until the
asyncExec Thread is finished and then call it. How can i do that? hope you
understand what i mean.
Thanks alot
Thomas
Re: Wait for async [message #479486 is a reply to message #479483] Tue, 11 August 2009 10:19 Go to previous messageGo to next message
Kevin Pollet is currently offline Kevin PolletFriend
Messages: 10
Registered: July 2009
Junior Member
Hi,

Have you try the synExec( Runnable method).
Normally, you wait until the runnable is executed.

Best regards,
Kévin
Re: Wait for async [message #479496 is a reply to message #479486] Tue, 11 August 2009 10:42 Go to previous messageGo to next message
T. Wilhelm is currently offline T. WilhelmFriend
Messages: 129
Registered: July 2009
Senior Member
Realm has no syncExec() :-( I already tried with exe() but it didnt seem
to work :-(
Re: Wait for async [message #479500 is a reply to message #479496] Tue, 11 August 2009 10:53 Go to previous messageGo to next message
Sascha Zak is currently offline Sascha ZakFriend
Messages: 11
Registered: July 2009
Junior Member
T. Wilhelm wrote:
> Realm has no syncExec() :-( I already tried with exe() but it didnt seem
> to work :-(


Hi Thomas,

which Realm class are you talking about?
Re: Wait for async [message #479501 is a reply to message #479500] Tue, 11 August 2009 10:54 Go to previous messageGo to next message
T. Wilhelm is currently offline T. WilhelmFriend
Messages: 129
Registered: July 2009
Senior Member
Oh sorry i talk about org.eclipse.core.databinding.observable.Realm
Re: Wait for async [message #479553 is a reply to message #479501] Tue, 11 August 2009 14:35 Go to previous messageGo to next message
Sascha Zak is currently offline Sascha ZakFriend
Messages: 11
Registered: July 2009
Junior Member
T. Wilhelm wrote:
> Oh sorry i talk about org.eclipse.core.databinding.observable.Realm
>

I don't know if there are different versions - the version
of org.eclipse.core.databinding.observable.Realm I found HAS a
syncExec() method, even though it has only 'protected' visibility.

Maybe there's the rub?
Re: Wait for async [message #479588 is a reply to message #479483] Tue, 11 August 2009 15:59 Go to previous message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

Have your main thread wait on an object and have another method that
performs a notify on the object (postQueryDone()). Then call postQueryDone
instead of fireQueryDone after the addAll call in your sample code. When
the wait in the main thread returns, call fireQueryDone.

"T. Wilhelm" <t.wilhelm@msh.de> wrote in message
news:ec1b074f3ab50b889e7775c9eafa7f5f$1@www.eclipse.org...
> Hey all,
>
> i have a problem concerning Display.asyncExe(myRunnable); or in detail
> with realm.asyncExe(myRunnable).
> I have a database and read some data from it in a Job. I registered my
> Model at this job as listener, and when the job is done my model gets the
> data from the job. Because i have a WritableList i use:
>
> realm.asyncExec(new Runnable() {
> @Override
> public void run() {
> myList.addAll(partnerList);
>
> fireQueryDone();
> }
> });
>
> Now my model have to update all views. Therefore as you can see i use
> observer pattern and call fireQueryDone(). This call i want to do in my
> main thread and not in the job thread, so i want to wait until the
> asyncExec Thread is finished and then call it. How can i do that? hope you
> understand what i mean.
> Thanks alot
> Thomas
>
Previous Topic:Re: Preferences: dependencies of FieldEditors
Next Topic:Hiding MenuContributions based Command ID
Goto Forum:
  


Current Time: Tue Jan 14 13:09:21 GMT 2025

Powered by FUDForum. Page generated in 0.03536 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top