Very interesting !!! i need to understand more in details but very good discussions. I will try to create a prototype...
Keep you posted Fred On Apr 24, 4:59 pm, Jason Essington <[email protected]> wrote: > Hi Fred, > > Sorry, as I said, I've not really worked on this much lately due to > lack of time. however there is a fairly detailed discussion from a > couple of years ago when I first decided to get GWT modules to run as > workers.http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse... > > Though the data there is undoubtably outdated, it might still be a bit > useful to you. > > -jason > > On Apr 24, 2009, at 8:33 AM, fvisticot wrote: > > > > > > > Jason, > > I allready use the Gears for GWT API. > > What is difficult for me to understand is how i could call GWT RPC > > code from my WorkerPool. > > Has you can see in the documentation the workerpool can only call > > javascript file !!!! no GWT code !!!! > > > What i would like to do is to modify the WorkerPool demo provided by > > the API: > > > private void doAsyncCalculation(int numDigits) { > > > if (workerPool == null) { > > workerPool = Factory.getInstance().createWorkerPool(); > > primeWorkerId = workerPool.createWorkerFromUrl > > ("pi_spigot_worker.js"); > > workerPool.setMessageHandler(this); > > } > > workerPool.sendMessage("START " + numDigits, primeWorkerId); > > } > > > I would like to replace the line: > > primeWorkerId = workerPool.createWorkerFromUrl("pi_spigot_worker.js"); > > > With somethink like that: > > First Solution: Need to modify/recreate the WorkerPool architecture.. > > MyWorkerPool myWorkerPool = new MyWorkerPool(); > > //MyWorkerPool should implements an execute method where the code is > > executed... > > primeWorkerId = myWorkerPool.execute(); > > > Second Solution: > > 1. Creating a Java file with the call to the GWT/RCP procedure (this > > method will be calle by the worker pool) > > 2. Compile this java file to generate a .js file > > 3. Call this js file with input parameters > > primeWorkerId = workerPool.createWorkerFromUrl(<generated-code.js>); > > > Can someone help me !!! > > > On Apr 21, 5:50 pm, Jason Essington <[email protected]> wrote: > >> you could start here:http://code.google.com/docreader/#p=gwt-google- > >> apis&s=gwt-google- > >> apis&t=GearsGettingStarted > > >> -jason > >> On Apr 18, 2009, at 2:47 PM, fvisticot wrote: > > >>> This discussion is very interesting and very promising !!! > >>> Is there any sample code, prototype demonstrating this capability ?? > >>> I think that calling GWT code from Worker Pool would be an added > >>> value > >>> for GWT applications !!! > >>> Fred > > >>> On Apr 17, 5:58 pm, Jason Essington <[email protected]> > >>> wrote: > >>>> On Apr 17, 2009, at 5:42 AM, Eric Z. Ayers wrote: > > >>>>> On Apr 16, 11:42 am, Jason Essington <[email protected]> > >>>>> wrote: > >>>>>> I am going on some stale gears info here, but ... > >>>>>> On Apr 15, 2009, at 3:15 PM, fvisticot wrote: > > >>>>>>> I would like to call GWT RPC method from my worker pool for > >>>>>>> synchronization process between dbs (client and server) > >>>>>>> It seems that the WorkerPool can only call javascript file or > >>>>>>> text > >>>>>>> script... > > >>>>>>> GWT purpose is to generate javascript as well so it is not > >>>>>>> possible > >>>>>>> to: > >>>>>>> 1. develop the method/class to invoke in the WorkerPool with > >>>>>>> GWT. > > >>>>>> yeah sure, create a new GWT module for each worker. there is a > >>>>>> GALGWT > >>>>>> project that should have some Gears integration stuff in it. > > >>>>> In theory, it would be possible to use GWT to generate code for > >>>>> workers in the worker pool, but I've never done it. If someone > >>>>> else > >>>>> has, I'd love to hear about it. > > >>>> Yup, done that. but it was back after the first Google Developer > >>>> day > >>>> (right after Gears was announced). GWT was at version 1.4 (maybe in > >>>> RC) I think, and linkers didn't really exist as such. > >>>> I ended up modifying the XS template to get the worker code. > > >>>> When I first did this, it only took about a day to get it up and > >>>> running, so I'd have to imagine that it'd be much easier now. > > >>>>> A new linker or manual trickery would > >>>>> be needed to eliminate relying on browser load event logic, > >>>>> which is > >>>>> inappropriate for WorkerPool threads. > > >>>>>>> 2. compile this method with GWT compiler > > >>>>>> yup, but you'll need to use the single script linker > > >>>>> Unfortunately, the reliance on browser events and window > >>>>> objects is > >>>>> present even in the SingleScriptLinker, but you could probably > >>>>> work > >>>>> around it. > > >>>> Well, this is the "don't shoot yourself in the foot" part. don't > >>>> use > >>>> window or any DOM methods ... which means no widgets or UI bits. > >>>> but > >>>> it is possible. but again, it is possible. > > >>>>>>> 3. call this method from the WorkerPool > > >>>>>> That one is one that I'm not sure on. At one time it was possible > >>>>>> to > >>>>>> issue XHR from a worker, but I was told that was a bug. I'm not > >>>>>> sure > >>>>>> if worker XHRs have been added or not. I'm sure someone that is > >>>>>> more > >>>>>> up to date on Gears can answer that one for you. > > >>>>> There is now a way to call an XHR using the HttpRequest object in > >>>>> WorkerPool, but again, since I haven't written code in GWT for a > >>>>> WorkerPool, I haven't tried to integrate GWT RPC. > > >>>> Well that's good news. theoretically then we could sync in the > >>>> background > > >>>>> Since GWT RPC is asyncronous, you could do the RPCs in the main > >>>>> thread > >>>>> and then send the result data as messages to Worker threads. > > >>>> Can objects now be passed to workers? if not, then performing the > >>>> RPC > >>>> in the main thread requires a second serialization/deserialization > >>>> trip, (only this time both are done in javascript) to get the > >>>> result > >>>> into the worker > > >>>> -jason
