FileDocCategorySizeDatePackage
ConvertClient.javaAPI DocExample2788Thu Mar 16 11:52:18 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());

        // Find the service by its interface type
        ServiceFinder sf = new ServiceFinder(ConvertService.class);
        ConvertService cs = (ConvertService) sf.getObject();
        LeaseRenewalManager lrm = new LeaseRenewalManager();

        // Sign up to be notified of all conversions
        RemoteEventListener rel = new ConvertEventHandler();
        EventRegistration er = cs.trackConversions(Lease.FOREVER, rel, null);
        lrm.renewUntil(er.getLease(), Lease.FOREVER, null);

        // Now do a conversion for ourself
        ConvertServiceRegistration csr = cs.getInstance(Lease.FOREVER);
        lrm.renewUntil(csr.getLease(), Lease.FOREVER, null);

        // Now invoke methods on the service object
        System.out.println(csr.convert(5));

        // We'll sit here, waiting forever for other event notifications
        // to happen.
        try {
            Thread.sleep(Integer.MAX_VALUE);
        } catch (InterruptedException ie) {}

        // If you want to exit, you should clean up the leases first, e.g., 
        // lrm.cancel(er.getLease());
        // lrm.cancel(csr.getLease());
        // System.exit(0);