• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I thought my urlybird program is ready

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!
reply
    Bookmark Topic Watch Topic
  • New Topic