try {
// See if there's a cached result (done == true) already
Conversion request = new Conversion(5, true);
Conversion result = (Conversion) js.read(request, null, JavaSpace.NO_WAIT);
if (result == null) {
// There was no cached result. Make a new request and retrieve
// that answer
request.done = new Boolean(false);
js.write(request, null, Lease.FOREVER);
request.done = new Boolean(true);
result = (Conversion) js.read(request, null, Long.MAX_VALUE);
}
// else just use the cached value
return result.result;
} catch (Exception e) {
throw new RemoteException("convert", e);
}