FileDocCategorySizeDatePackage
ConvertClient.javaAPI DocExample2545Thu Mar 16 11:52:14 GMT 2000None

ConvertClient

public class ConvertClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        System.setSecurityManager(new RMISecurityManager());
        LeaseRenewalManager lrm = new LeaseRenewalManager();

        // Find the JavaSpaces service
        ServiceFinder sf = new ServiceFinder(JavaSpace.class);
        JavaSpace js = (JavaSpace) sf.getObject();

        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);
            Lease l = js.write(request, null, Lease.FOREVER);
            lrm.renewUntil(l, Lease.FOREVER, null);
            request.done = new Boolean(true);
            result = (Conversion) js.read(request, null, Long.MAX_VALUE);
            lrm.cancel(l);
            lrm.remove(l);
        }
        // else just use the cached value

        System.out.println(result.result);
        System.exit(0);