• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

need help with locking  RSS feed

Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm really having trouble with record locking on the urlybird project. I'm using RMI. I have a local interface called UrlyBirdDBAccess and a remote interface called RemoteUrlyBirdDBAccess. I have a factory that returns either a local connection (object that implements UrlyBirdDBAccess) or a remote one through RMI (object that implements RemoteUrlyBirdDBAccess), however I use an adapter to transform the object that implements the RemoteUrlyBirdDBAccess interface to an object that implements the UrlyBirdDBAccess interface so the client doesn't need to know the difference between the actual connections.

When I run in a standalone mode (i.e. local connection), the lock and unlock methods implemented in the UrlyBirdDBAccess do nothing...record locking is not an issue in standalone mode.

I'm having trouble implementing the lock and unlock methods for the RemoteUrlyBirdDBAccess interface. On the remote side, do I need to call the methods lock and unlock defined in the UrlyBirdDBAccess interface or is
it ok to just ignore them in terms of implementing the lock and unlock methods declared in RemoteUrlyBirdDBAccess.
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are better off implementing the locking code for both standalone and networked access. This simplifies the code and makes testing your record locking a lot easier since you can test it with a program that uses it locally.

The cost of doing the synchronization and lockin when there is only one thread is probably about the same as the cost of determining if the database is being accessed locally or remotely.
Do not set lab on fire. Or this tiny ad:
global solutions you can do at home or in your backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!