This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Threads and Synchronization and the fly likes Bank account simulation Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Bank account simulation" Watch "Bank account simulation" New topic
Author

Bank account simulation

Urs Waefler
Ranch Hand

Joined: Mar 13, 2007
Posts: 77
Hi

There are two persons in a bank. One person puts 1'000'000 times a certain amount of money in an account, at the same time an other person gets the same amount of money from the same account 1'000'000 times. This is my code so far:



Everything is fine so far, the code compiles. But I do not have any idea at the moment, how to continue. Who can help me?

Regards, Urs


SCJP 1.4
Alistair J MacDonald
Greenhorn

Joined: Jul 15, 2011
Posts: 8
There appears to be a lot of code missing from the code you have provided.
Urs Waefler
Ranch Hand

Joined: Mar 13, 2007
Posts: 77
Is this a help? I continued, actually I am in the middle of the development.
Alistair J MacDonald
Greenhorn

Joined: Jul 15, 2011
Posts: 8
I could help, but if you are in the middle of development I guess you are not stuck.
John Vorwald
Ranch Hand

Joined: Sep 26, 2010
Posts: 139
Try semaphore with consumer / producer....
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Bank account simulation
 
Similar Threads
Thread question
java.lang.IllegalThreadStateException
Banking with Threads
How to get a transfer function to work both ways?
Program like ATM where person enters amount in dollars and cents but program uses int for monies