• 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

client and lock

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been stuck with this issue for quite a while now: where should I handle the mapping between clients and database's record locks? And how can I distinguish clients in their requests to server? I appreciate any pointer/hint. Thank you.
 
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

cody monk wrote:where should I handle the mapping between clients and database's record locks?


That depends on your design. Some people created a few helper classes: one for the i/o operations (read, create,...) and another one for the record locking (lock, unlock) and just use the Data class as a facade. In this approach you keep that kind of data in the locking helper class. Other people (like me) just have everything in their Data class and then it's obvious you should keep this information in the Data class.

cody monk wrote:And how can I distinguish clients in their requests to server?


That depends on your interface you must implement. If you have one with a lockCookie, you use this cookie to identify the clients. If you don't have such a lockCookie in your interface you have to come up with something of your own to identify clients. If you choose sockets as a networking solution, you can make sure that the requests of a client are handled by the same thread (so you could use the thread id to identify the client). If you use RMI you don't have that guarantee and you have to hink of something else (e.g. setting the client id before each request it makes)
 
reply
    Bookmark Topic Watch Topic
  • New Topic