Record locking with Community Commons

3
I am hoping to use a record locking mechanism using the java functions included in the ORM section of the Community Commons module. Looking at how this seems to work (like black magic!!) it seems to me that the locks are stored in server memory rather than in records in the database. Is this correct? The reason this is important to me is that my customer has 2 load balanced servers, so if a record is locked on one node, a user checking for a lock who is connected to the other node will not see that the record is locked. Is the record locking in Community Commons useable in a load-balanced architecture? Can it be amended to store the locks in a database table?
asked
1 answers
1

The locks are stored in memory for performance and to keep the operation atomic. You could model an additional entity in the domain model to store the locks, and adjust the Java accordingly (shouldn't be to hard).

Disadvantages of this approach are a small performance hit, and that locks cannot be guaranteed (although the chances will be very small that two persons will get the lock at the same time, they have to obtain the lock in about the same millisec).

answered