FileDocCategorySizeDatePackage
ConvertServiceImpl.javaAPI DocExample3137Thu Mar 16 11:52:34 GMT 2000None

ConvertServiceImpl

public class ConvertServiceImpl extends UnicastRemoteObject implements ConvertServiceProxy

Fields Summary
private ServerLandlord
lord
Constructors Summary
public ConvertServiceImpl()

        lord = new ServerLandlord();
    
Methods Summary
public java.lang.Stringconvert(Lease l, int i)

        Hashtable cache = (Hashtable) lord.getSessionData(l);
        if (cache == null)
            throw new LeaseDeniedException("Lease expired");
        Integer I = new Integer(i);
        String s;
        s = (String) cache.get(I);
        if (s != null)
            return s;
        s = I.toString();
        cache.put(I, s);
        return s;
    
public ConvertServiceRegistrationgetInstance(long duration)

        Hashtable ht = new Hashtable(13);
        return new ConvertServiceRegistrationImpl(this, lord.newLease(ht, duration));
    
public static voidmain(java.lang.String[] args)

        System.setSecurityManager(new RMISecurityManager());
        String[] groups = new String[] { "" };

        // Create the instance of the service; the JoinManager will
        // register it and renew its leases with the lookup service
        ConvertServiceImpl csi = (ConvertServiceImpl) new ConvertServiceImpl();
        JoinManager manager = new JoinManager(csi, null, groups,
                                              null, null, null);