Problem with Thread in GWT2.0

2010-02-03 Thread SergeZ
Hi everybody! I meat the following problem. When my GWT app is started it is very necessary to make an asynchronous call - to gether some data. If i make this call directly from OnModuleLoad() method - then i getting the result, but when I putting the call of my method in a thread: OnModuleLoad

Re: Problem with Thread in GWT2.0

2010-02-04 Thread mariyan nenchev
Java script is sigle threaded, you can not use threads in the client side of gwt project. Just use AcyncCallback. On Thu, Feb 4, 2010 at 2:18 AM, SergeZ wrote: > Hi everybody! I meat the following problem. When my GWT app is > started it is very necessary to make an asynchronous call - to gethe

Re: Problem with Thread in GWT2.0

2010-02-05 Thread SergeZ
Thanx, the answer is clear, but if JavaScript is a single-threaded, then how this code can works? private void makeATL(final String router) { Runnable onLoadCallback = new Runnable() { public void run() { //some code

Re: Problem with Thread in GWT2.0

2010-02-06 Thread mariyan nenchev
I never used runnables in my client gwt code, look what js is generated from this code. See this to comfirm my statement: http://stackoverflow.com/questions/161783/is-javascript-single-threaded-if-not-how-do-i-get-synchronized-access-to-shared On Fri, Feb 5, 2010 at 11:55 AM, SergeZ wrote: > Tha

Re: Problem with Thread in GWT2.0

2010-02-06 Thread Alexander
I suppose all runnable are invoked in one thread without new thread creation. On 6 February 2010 15:22, mariyan nenchev wrote: > > I never used runnables in my client gwt code, look what js is generated > from this code. > See this to comfirm my statement: > > http://stackoverflow.com/questions/

Re: Problem with Thread in GWT2.0

2010-02-06 Thread bch...@gmail.com
Why not. Just run it "later" in a same thread. On Feb 5, 5:55 pm, SergeZ wrote: > Thanx, the answer is clear, but if JavaScript is a single-threaded, > then how this code can works? > > private void makeATL(final String router) { >                 Runnable onLoadCallback = new Runnable() { >    

Re: Problem with Thread in GWT2.0

2010-02-06 Thread Joe Cheng
SergeZ, In your first example, simply instantiating a Runnable does nothing--you need to call run() on it to make it run. But this doesn't make it run on a different thread. To run it on a different thread, you'd have to instantiate Thread using the Runnable instance as a constructor argument. Ma

Re: Problem with Thread in GWT2.0

2010-02-07 Thread SergeZ
Thanks to your all for answers on my question! I'll try to call the run() method ( how can I\ forgot to call it)) ). But I thinking that it will not helps me... Actually, I have the one concrete task - create some similarity to monitoring system. My software must receive data from DataBase and re

Re: Problem with Thread in GWT2.0

2010-02-08 Thread Joe Cheng
If you use a timer, your data will be delayed by up to the period of the timer (e.g. if your timer fires every 5 seconds then there will be a delay of up to 5 seconds to display your data). Rather than an infinite while or for loop, you can "loop" by having the RPC call's AsyncCallback onSuccess a

Re: Problem with Thread in GWT2.0

2010-02-08 Thread Alexander
SergerZ, infinity loop never seems to be a good idea. You won't ever get realtime behaviour as you can't get out from client-server paradigm. So only emulate. This timer solution is good. Btw, maybe you want to look at http://code.google.com/p/rocket-gwt/ server push technology. On 8 February 20

Re: Problem with Thread in GWT2.0

2010-02-08 Thread SergeZ
Can you give a simple example of how to make this "looped" asynccallback call ? On 8 фев, 11:39, Joe Cheng wrote: > If you use a timer, your data will be delayed by up to the period of the > timer (e.g. if your timer fires every 5 seconds then there will be a delay > of up to 5 seconds to display

Re: Problem with Thread in GWT2.0

2010-02-08 Thread SergeZ
Thanks for the reference. This feature is very interesting! On 8 фев, 14:20, Alexander wrote: > SergerZ, infinity loop never seems to be a good idea. > > You won't ever get realtime behaviour as you can't get out from > client-server paradigm. So only emulate. This timer solution is good. > > Btw

Re: Problem with Thread in GWT2.0

2010-02-08 Thread Tom Schindl
You might want to have something like comet. Take a look at http://code.google.com/p/gwteventservice/ Tom On Mon, Feb 8, 2010 at 1:22 PM, SergeZ wrote: > Can you give a simple example of how to make this "looped" > asynccallback call ? > > On 8 фев, 11:39, Joe Cheng wrote: >> If you use a timer

Re: Problem with Thread in GWT2.0

2010-02-09 Thread Joe Cheng
I just meant something like this. void *pollForEvents() *{ server.getEvents(new AsyncCallback() { public void onSuccess(Event[] result) { handleEvents(result); *pollForEvents();* } public void onFailure(Throwable caught) { // do something with the error... if

Re: Problem with Thread in GWT2.0

2010-02-10 Thread KeremTiryaki
final Timer t=new Timer() { int i=0; @Override public void run() { greetingService.getDataHit( new AsyncCallback() {

Re: Problem with Thread in GWT2.0

2010-02-10 Thread SergeZ
Thanks a lot for you all I currently stopped at timer's solution - just for quickly gett the working app, and further I planned to use GWTeventservice library - it's a very useful feature. On 10 фев, 22:49, KeremTiryaki wrote: >                       final Timer t=new Timer() { >