Reputation: 13
In our application there are various documents which users open and if necessary, updates them and while doing this process that particular document is locked for other users. So we have a table where an entry is inserted when an document is opened by any user. For ex his username and docId. Now we have a session, for ex if user has open the document and kept it idle or if user has logged off then the documents are automatically unlocked and they well handled.
But, recently we noticed that there are scenarios where if users opens an document and his system shuts down automatically or if application hangs, user closes it through task manager than in that case the entry is not removed from the table and the document remains lock and it shows lock for other users as well.
Is there any way where we can handle this type of scenarios where if users system closes abruptly and if there’s any document opened on this system should be unlocked and the entry should be removed from the table?
I tried doing R&D’s, i came across form close event etc but i am not even sure if what i am searching is relevant to what my expectation is.
Upvotes: 0
Views: 77
Reputation: 31721
case the entry is not removed from the table and the document remains lock and it shows lock for other users as well.
Either focus on the system that keeps the document "locked" and "unlock" it after a certain period of inactivity.
Or have the app keep a log of activity, so that when it dies, that it resumes the session with the host.
Regardless, you should be handling normal shutdown events, such as window close, and removing any locks on the document.
Upvotes: 0