Designing RMI Applications

Two Choices


//One instance of Bank for all clients
class Bank {
  public Money getBalance(Account account) throws RemoteException;
  public void makeDeposit(Account account)
    throws RemoteException, NegativeAmountException;
  public void makeWithdrawal(Account account, Money amount)
    throws RemoteException, OverdraftException, NegativeAmountException;
}

//One instance of Account for each account
class Account {
  public Money getBalance() throws RemoteException;
  public void makeDeposit(Money amount)
    throws RemoteException, NegativeAmountException;
  public void makeWithdrawal(Money amount)
    throws RemoteException, OverdraftException, NegativeAmountException;
}
  

José M. Vidal .

3 of 49