I would like to know if it would be possible to call Java method of a GWT module within a worker in a Google Gears workerpool. For example 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.
Thanks for the help.