• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Book : Sun Certified Java developer Exam with J2SE1.4 ISBN:1-59059-030-9

 
Zhi Gang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, boys and girls .. here is anotehr question from me .. ^_^ thanks in advance.
1.i had read the book The Sun Certified Java developer Exam with J2SE1.4 ISBN:1-59059-030-9
i got really confuse on page no.126 & 127 according to my interpretation - alike the multi-threaded only exsit by using multiple-instances in DVDDatabase object. Does it mean that if i only have a single DVDDatabase object i can not achive multi-threaded? (there are 2 diagrams & pls read the decription)
could some one please explain .
2.i am using RMI for my assignment, and create only one instance of Data object acess by multiple clients does it mean that no multi-threading b'coz i am using single instance of Data??
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zhi,
I wrote that book, so I may be able to help. However, I'm having some trouble understanding your question. Can you please break it down a bit?
Thanks,
M
 
Zhi Gang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for reply max.
In page 126 a diagram with a description
"multithreaded DVDDatabase object"
In page 127 a diagram with a description
"Single DVDDatabase object"
it sound like the single DVDDatabase object is much more thread-safe then the multithreaded DVDDatabase object. and i don't undersatnd why it choose to use multithreaded DVDDatabase object.
2. IF i am Using RMI, does it still matter where i use multithreaded DVDDatabase object? RMI will only create one instances anyway? ( i might be dull )
thanks for your help ..
by the way, i love your book ^_^ it helps alot.
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Zhi Gang:
thanks for reply max.
In page 126 a diagram with a description
"multithreaded DVDDatabase object"
In page 127 a diagram with a description
"Single DVDDatabase object"
it sound like the single DVDDatabase object is much more thread-safe then the multithreaded DVDDatabase object. and i don't undersatnd why it choose to use multithreaded DVDDatabase object.

For the same reasons that you would multithread anything: it makes the customer experience better. For example, the multithreaded approach allows different customers to use different records at the same time, while the single threaded ques them up(mind you, it's a short que).


2. IF i am Using RMI, does it still matter where i use multithreaded DVDDatabase object? RMI will only create one instances anyway? ( i might be dull )

No, it still matters. RMI will create as many instances as you tell it to.

thanks for your help ..
by the way, i love your book ^_^ it helps alot.

Hell, don't tell me, review it on Amazon .
 
Joyce Lee
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

posted by Max
For the same reasons that you would multithread anything: it makes the customer experience better. For example, the multithreaded approach allows different customers to use different records at the same time, while the single threaded ques them up(mind you, it's a short que).

By referring to the Denny’s DVD code, I still don’t understand or appreciate the use of multithreaded DVDDatabase instances (pg 126, figure 4.13). The single threaded (pg 127, figure 4.14) still can allow different customers to use different records by introducing a private Vector reserveDVD (without static since there’s only a single DVDDatabase instance).
I noticed that there’re people using multithreaded instances approach (i.e. creating a new instance of Data object for each client) for their assignments. I don’t understand. Could someone please explain why multithreaded instances approach is favorable over single instance approach?
Thanks,
Joyce
---
working on Contractor assignment v2.3.3
 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With an instance per connection, the lock/s that a particular connection holds can be tracked.
tony
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic