FileDocCategorySizeDatePackage
AccountServer.javaAPI DocExample2560Thu Dec 15 21:45:10 GMT 2005com.oreilly.jent.rmi

AccountServer

public class AccountServer extends Object
AccountServer: A utility class that registers an Account with the local RMI registry for remote access

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

        try {
            System.setSecurityManager(new RMISecurityManager());
            // Make an Account with a given name
            AccountImpl acct = new AccountImpl("JimF");
            
            // Register it with the local naming registry
            Naming.rebind("JimF", acct);
            System.out.println("Registered account as JimF.");
            
            // Keep the server process alive indefinitely
            Object dummy = new Object();
            synchronized (dummy) {
                try {
                    dummy.wait();
                }
                catch (InterruptedException ie) {}
            }
        }
        catch (RemoteException re) {
            System.err.println("Remote exception while creating/registering: "
                               + re.getMessage());
        }
        catch (MalformedURLException mue) {
            System.err.println("Bad name given when binding server object: "
                               + mue.getMessage());
        }