Wait for async [message #479483] |
Tue, 11 August 2009 10:08 |
|
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 #479588 is a reply to message #479483] |
Tue, 11 August 2009 15:59 |
Eclipse User |
|
|
|
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.03536 seconds