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.
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