public void stop() {
this.running = false;
}
public void run() {
AbstractMethodCallEntry t = new AbstractMethodCallEntry();
// Needed for match
t.uid = null;
t.className = businessInterface.getName();
this.methodCallEntryTemplate = jsTemplate.snapshot(t);
final boolean debug = log.isDebugEnabled();
if (debug)
log.debug("Worker " + this + " starting...");
while (running) {
if (debug)
log.debug("Worker " + this + " waiting...");
// On reading from the space, the result will be computed and
// written
// back into the space in one transaction
jsTemplate.execute(new JavaSpaceCallback() {
public Object doInSpace(JavaSpace js, Transaction transaction) throws RemoteException,
TransactionException, UnusableEntryException, InterruptedException {
// look for method call
AbstractMethodCallEntry call = (AbstractMethodCallEntry) js.take(methodCallEntryTemplate,
transaction, waitMillis);
if (call == null) {
// TODO is this required?
if (debug)