Results 61 to 68 of 68
Thread: Threads!!!
- 11-13-2011, 03:51 PM #61
Member
- Join Date
- Sep 2011
- Posts
- 64
- Rep Power
- 0
- 11-13-2011, 03:56 PM #62
Re: Threads!!!
No, I can't guarantee that your code will work. I'm not sure exactly what you want it to do. I have not looked at any of your usages of Threads and synchronization. There were too many other bugs that needed solving first.
I've asked you several questions about your code as leads for you to look at why the code was doing what I observed and you have ignored them. Go back through my posts and make sure you know what is happening in your code in relation to the questions I asked.
Reread post#60.
- 11-13-2011, 04:05 PM #63
Member
- Join Date
- Sep 2011
- Posts
- 64
- Rep Power
- 0
Re: Threads!!!
My apologies, I thought I had answered all of your questions, and have put println's in every place I can imagine. I looked at post #60, but that did not have questions, it was a recent post today, based on me going through the threads of this discussion.
Again, my apologies, I am doing the best I can.
Thanks for trying to help me.
- 11-13-2011, 04:34 PM #64
Re: Threads!!!
Look at posts 48, 50, 52, 55 and 57
- 11-13-2011, 04:50 PM #65
Member
- Join Date
- Sep 2011
- Posts
- 64
- Rep Power
- 0
Re: Threads!!!
From Number 48....
Perhaps you should simplify the testing to see if each of the steps the Client does works.
For example do only a balance enquiry.
The do a balance enquiry and a deposit and a balance enquiry.
How have instances of the Account class is the program supposed to create?
First Question or Statement above:
I will limit it to just a BALANCE and see if I can track this down, I would assume the goal is to not make the Server.java program HANG and complete normally, something that I have not been able to do...
Second Questions:
I believe that the Account class should only have 1 instance, since we have a single Account and one person making DEPOSIT and WITHDRAWALS.
I don't know of a way to verify that is happening, any insight would be helpful on how to check that?
- 11-13-2011, 04:58 PM #66
Re: Threads!!!
Add some println statements.I don't know of a way to verify that is happening,
Look at my printout from when I executed the program. Look for this: "new Account created"
Count how many times that is printed out.
Exiting main
new Account created
ATMImp bal=10000.0, this=ClientServer6$ATMImplementation@1a758cb
new Account created
ATMImp bal=10000.0, this=ClientServer6$ATMImplementation@69b332
S - Accepting clients now
S - Client acquired on port #7777, reading from socket
ATMProxy writing command to server: BALANCE
new Account created
ATMImp bal=10000.0, this=ClientServer6$ATMImplementation@1270b73
S - requestQueue Size is: 1
S - commandLine equals: BALANCE
ATMR - requestQueue Size is: 1
ATMR - requestQueue Size is: 1
ATMR - I am returning atmRunnableItem=ATMRn cmdLine=BALANCE
ATMR run - Threads should go here eventually... cL=BALANCE
ATMImpl BALANCE=10000.0
ATMR run println result=10000.0
ATMProxy: Server returned: 10000.0
C1 - Balance: 10000.0
C2 - Depositing: 1000 DDD0
ATMProxy writing command to server: DEPOSIT
new Account created
ATMProxy writing command to server: BALANCE
ATMImp bal=10000.0, this=ClientServer6$ATMImplementation@16caf43 <<<<<<<<<<<<<
S - requestQueue Size is: 1
S - commandLine equals: DEPOSIT 1000.0
ATMR - requestQueue Size is: 1
ATMR - requestQueue Size is: 1
ATMR - I am returning atmRunnableItem=ATMRn cmdLine=DEPOSIT 1000.0 DDD1
new Account created
ATMImp bal=10000.0, this=ClientServer6$ATMImplementation@8813f2 <<<<<<<<<<<<<
S - requestQueue Size is: 1
S - commandLine equals: BALANCE
ATMR - requestQueue Size is: 1
ATMR - requestQueue Size is: 1
ATMR - I am returning atmRunnableItem=ATMRn cmdLine=BALANCE
ATMR run - Threads should go here eventually... cL=DEPOSIT 1000.0
ATMImpl making a DEPOSIT amt=1000.0, new balance=11000.0 DDD2
ATMR run - Threads should go here eventually... cL=BALANCE
ATMImpl BALANCE=11000.0
ATMR run println result=11000.0
ATMProxy: Server returned: 11000.0 DDD3
C3 - Balance: 11000.0
WWW0
C4 - Withdrawing: 250
ATMProxy writing command to server: WITHDRAW
new Account created
ATMProxy writing command to server: BALANCE
ATMImp bal=10000.0, this=ClientServer6$ATMImplementation@83cc67 <<<<<<<<<<<<<
S - requestQueue Size is: 1
S - commandLine equals: WITHDRAW 250.0 WWW1
ATMR - requestQueue Size is: 1
ATMR - requestQueue Size is: 1
ATMR - I am returning atmRunnableItem=ATMRn cmdLine=WITHDRAW 250.0
new Account created
ATMR run - Threads should go here eventually... cL=WITHDRAW 250.0
ATMImp bal=10000.0, this=ClientServer6$ATMImplementation@de6f34 <<<<<<<<<<<<<
S - requestQueue Size is: 1
S - commandLine equals: BALANCE
ATMR - requestQueue Size is: 1
ATMImpl making a WITHDRAWAL amt=250.0, new balance=10750.0 WWW2
ATMR - requestQueue Size is: 1
ATMR - I am returning atmRunnableItem=ATMRn cmdLine=BALANCE
ATMR run - Threads should go here eventually... cL=BALANCE
ATMImpl BALANCE=10750.0
ATMR run println result=10750.0
ATMProxy: Server returned: 10750.0 WWW3
C5 - Balance: 10750.0
C6 - Withdrawing: 750
ATMProxy writing command to server: WITHDRAW
new Account created
ATMProxy writing command to server: BALANCE
ATMImp bal=10000.0, this=ClientServer6$ATMImplementation@47b480 <<<<<<<<<<<<<
S - requestQueue Size is: 1
S - commandLine equals: WITHDRAW 750.0
ATMR - requestQueue Size is: 1
ATMR - requestQueue Size is: 1
ATMR - I am returning atmRunnableItem=ATMRn cmdLine=WITHDRAW 750.0
new Account created
ATMR run - Threads should go here eventually... cL=WITHDRAW 750.0
ATMImp bal=10000.0, this=ClientServer6$ATMImplementation@10d448
S - requestQueue Size is: 1
S - commandLine equals: BALANCE
ATMR - requestQueue Size is: 1
ATMImpl making a WITHDRAWAL amt=750.0, new balance=10000.0
ATMR - requestQueue Size is: 1
ATMR - I am returning atmRunnableItem=ATMRn cmdLine=BALANCE
ATMR run - Threads should go here eventually... cL=BALANCE
ATMImpl BALANCE=10000.0
ATMR run println result=10000.0
ATMProxy: Server returned: 10000.0
C7 - Balance: 10000.0
ATMProxy: Sending End program
S - End program
2Back from Client.main() call
S - Client serviced
S exiting main
0 error(s)
- 11-13-2011, 05:21 PM #67
Member
- Join Date
- Sep 2011
- Posts
- 64
- Rep Power
- 0
Re: Threads!!!
Ok, I count 9 in your printout, I just put a println in ATMImplementation and counted 5 from just doing a single Balance command, which obviously is to many, i only need 1....
This is getting called each time I run a COMMAND, since it calls ATM which ATMImplementation.java implements...
Not sure how to get around this.
- 11-13-2011, 05:24 PM #68
Similar Threads
-
Threads
By nsr2008.mca in forum New To JavaReplies: 7Last Post: 10-18-2010, 11:47 AM -
Threads and UML
By JUser in forum Advanced JavaReplies: 0Last Post: 09-27-2010, 08:43 PM -
Threads
By Tanuck in forum New To JavaReplies: 5Last Post: 09-21-2010, 02:44 AM -
When to use threads
By simorgh in forum Threads and SynchronizationReplies: 2Last Post: 02-12-2010, 07:43 AM -
Threads
By one198 in forum Threads and SynchronizationReplies: 1Last Post: 11-20-2007, 06:15 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks