regarding question 2a), in 2.5.3 we can implement this behavior without using persistent session, but then I need to update the community commons package.
2b). The system logs user automatically out after 5 minutes after the browser has been closed. In combination with 2a, this means that the lock will be released within 5 minutes after the browser close/ crash.
However note that if somebody opens a window, and then leaves his computer for 8 hours without closing his browser or session, he will have the lock for that 8 hours.
We just released version 1.2 of the library; locks will be removed automatically after an session has expired or was killed somehow.
a) First of all, I did not test it extensively.
b) One pitfall is that currently if you are not using persistent sessions (which is the default), locks will not be released automatically if a session ends without releasing the lock (for example when you open an edit form and then kill the browser). If you change to Mendix 2.5.3 I can solve this issue since 2.5.3 has better session management support.
c) Note that when exceptions occur, you still need to release the locks.
d) Note that certain client widgets (inline datagrids for example) might directly modify your object, without looking at the locks.
FYI: I filed a Feature Request for this topic (nr 7774).
The communitycommons method seem to work OK, but for 2 reasons I would like this functionality in the Modeler (automated) for the following reason:
Modeling the record lock has quite an impact: - Firstly because modelling this functionality takes quite some time in several screens - Secondly because now this record-locking functionality must be modelled, the risk of making errors is quite high
The proposal is that this functionality can be activated by either
- Application-wide set "recordlocking" to enabled (which means that only 1 person can open a record)
- Per grid (datagrid, reference set and template grid) enable / disable recordLocking (if you don't want to have it active application-wide)
After discussing this issue with the customer that requested this, I have the following remarks / questions:
1) Our customer was very surprised that it's no central feature of Mendix, since Mendix is a Web-based tool, wich often is multi-user, with higher risk of overwriting eachothers records... What is the experience of others in this area: do many of you need this functionality? Or do most of you not need this? I'm wondering!
2) For our customer it is needed is that when a record is locked due to a crash or browser-close, after 30 (or 15?) minutes, this is released, to make sure that things are accessible without interference of an administrator.
a: If I want to have this, do I then need persistent sessions*?
b: If the release-time is 15 or 30 minutes and I for some reason need 35 minutes time for editing a record: am I also logged out automatically, or has the login-system nothing to do with it?
I hope there is some additional advice and I wonder about others expieriencing (or not experiencing!) this problem...
I have updated to the new "Community Commons Function Library v1.2" and implemented the lock-mechanism in the application. As far as I can see it works fine, so thanks!
Is it true that a lock will not be removed when I open a record on computer A (and have called acquireLock() on the opening) and then browse away to an entirely other web-page, but do NOT close my browser...? As far as I can test, the record will not be released automatically in this case, can this be confirmed?
I think on the production-environment, I have to configure the scheduled event "releaseOldLocks", correct? Or isn't it necessary because this event is triggered by a Java-action?
Thanks in forward for the answer!
The answer to your first question lies in the second question. If you enable the releaseOldLocks Scheduled Event, AND the 'enableReleaseLockEvent' constant is set to true, the locks should be released automatically if the browser window is closed in less then 10 minutes.
(Assuming that you work on mendix 2.5.3, but I guess it wont compile otherwise)