I would like to know if it would be possible to call Java method
within a worker in a workerpool. For example given the class and
method

package com.mycomp;

public class MyClass implements EntryPoint, WorkerPoolMessageHandler {
public void mymethod() {
...
}}

Is it possible to define 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?

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

Thanks for the help.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to