edu.pdx.cs399J.net
Class SynchronizedATM
java.lang.Object
edu.pdx.cs399J.net.ATM
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.
|
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 |
SynchronizedATM
public SynchronizedATM(String name,
BankAccount account,
int[] transactions)
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.