After following through the discussion@

http://groups.google.com/group/gears-users/browse_thread/thread/5da08868ee98d871/52042c1a43efd7b9

(only found this out recently). I would like to know if it is actually
possible to call a java method of a GWT module within a worker in a
Google Gears workerpool. Specifically given the class and method of a
GWT module.

   package com.mycomp;
   public class MyClass implements EntryPoint,
WorkerPoolMessageHandler {
   public void mymethod() {
     ...
   }}

I have tried defining the following JSNI method

   private native String javamethod() /*-{

     var workerCode = 'google.gears.workerPool.onmessage = function
(a,b,message) { google.gears.workerPool.sendMessage(update
(),message.sender); };';

     function update() {
      [email protected]::mymethod();
      return "Done";
     };

     workerCode += String(update);

     return workerCode;

    }-*/;

and use the following code to define a worker to invoke mymethod().

   WorkerPool wp = Factory.getInstance().createWorkerPool();
   wp.setMessageHandler(this);
   int workerId = wp.createWorker(javamethod());
   wp.sendMessage("update", workerid);

But this seems to be not possible. It would be great if someone could
let me know if there is another way.

I have posted similar quest...@gwt group.

http://groups.google.com/group/google-web-toolkit/browse_thread/thread/ce4d2eefa2e170b5#

Thanks for the help.

Reply via email to