edu.pdx.cs399J.net
Class SynchronizedATM

java.lang.Object
  extended by edu.pdx.cs399J.net.ATM
      extended by edu.pdx.cs399J.net.SynchronizedATM
All Implemented Interfaces:
Runnable

public class SynchronizedATM
extends ATM

This class demonstrates obtains a lock before access the BankAccount. That way, it always sees a consistent view of the account.


Field Summary
 
Fields inherited from class edu.pdx.cs399J.net.ATM
account, name, out, transactions
 
Constructor Summary
SynchronizedATM(String name, BankAccount account, int[] transactions)
           
 
Method Summary
static void main(String[] args)
          Create a couple of accounts and have them all perform the same transactions, but in different orders.
 void run()
          Perform each transaction on the account
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizedATM

public SynchronizedATM(String name,
                       BankAccount account,
                       int[] transactions)
Method Detail

run

public void run()
Perform each transaction on the account

Specified by:
run in interface Runnable
Overrides:
run in class ATM

main

public static void main(String[] args)
Create a couple of accounts and have them all perform the same transactions, but in different orders.



Copyright © 2000-2009 Portland State University. All Rights Reserved.