This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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.
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!