Peter
unread,Nov 10, 2009, 12:08:24 PM11/10/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Web Toolkit
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() {
this.@com.mycomp.MyClass::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.