FileDocCategorySizeDatePackage
AccountClient.javaAPI DocExample2476Thu Dec 15 21:43:52 GMT 2005com.oreilly.jent.rmi

AccountClient

public class AccountClient extends Object
AccountClient: An example client for an RMI-exported Account.

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

    try {
      System.setSecurityManager(new RMISecurityManager());
      
      // Lookup account object
      Account jimAcct = (Account)Naming.lookup("rmi://localhost/JimF");
      
      // Make deposit
      jimAcct.deposit(12000);
      
      // Report results and balance.
      System.out.println("Deposited 12,000 into account owned by " +
                         jimAcct.getName());
      System.out.println("Balance now totals: " + jimAcct.getBalance());
    }
    catch (RemoteException re) {
      System.err.println("Remote exception while looking up account: "
                         + re.getMessage());
    }
    catch (NotBoundException nbe) {
      System.err.println("Server object not found at expected URL: "
                         + nbe.getMessage());
    }
    catch (MalformedURLException mue) {
      System.err.println("Bad RMI URL given for server object: "
                         + mue.getMessage());
    }