aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes I thought my urlybird program is ready Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "I thought my urlybird program is ready" Watch "I thought my urlybird program is ready" New topic
Author

I thought my urlybird program is ready

Benedikt Grabenmeier
Greenhorn

Joined: Jan 17, 2011
Posts: 3
... until I re-read the instructions about locking
"Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available. "
After spending some hours reading all these topics about locking I'm confused.
Here is my workflow by booking a room:
- establish a rmi connection to the server
- client calls the lock method in the server:
[edit] do not provide complete actual code snippets
- client receives the cookie and calls update ()
- client calls unlock:
[edit] do not provide complete actual code snippets

Now I'm wondering whether I choosed a too easy (and maybe wrong) way?
Do I have to create Threads for every client by my own?
Regards
Benne
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5282
    
  13

That's exactly what my implementation does too. One of the benefits of choosing a RMI solution, is that RMI creates the threads for you, so no need to do it yourself.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Roel De Nijs wrote:That's exactly what my implementation does too. One of the benefits of choosing a RMI solution, is that RMI creates the threads for you, so no need to do it yourself.


Agreed. When I first started to read the instructions, I was also in doubt if I had to say somewhere new Thread(), but the thing is that these Threads have to be created in order to allow the server to handle multiple requests at a time, but when you use RMI you don't have to do it.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Benedikt Grabenmeier
Greenhorn

Joined: Jan 17, 2011
Posts: 3
Thanks!
 
wood burning stoves
 
subject: I thought my urlybird program is ready