This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I thought my urlybird program is ready

 
Benedikt Grabenmeier
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... 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
Sheriff
Posts: 9823
102
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Benedikt Grabenmeier
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic