java - Lock record and release lock after user action from jsp pages -
i have requirement in page have table having list of records. when user clicked on 1 record, record should locked , else old view of overview screen tries click on record, shows pop message 'sorry record in progress'.
i thought of adding column in db table create entry 'in prodress' when click , see particular record , later when close record update column 'free'. have issue here if select record , close browser straight without closing , releasing lock in case nobody able see record.
please allow me know if there other way implement or how can implement in above mention case.
condition 1 : 2 user login @ same time record available both in normal color green. user 1 click on record , start editing. in case there should kind of lock if user 2 tries open same record pop message 'in progress'.
condition 2 : user 1 login , see record in greenish color. user 2 login , see same record in gray color. should not able click record.
the problem have why not done way. if have hard lock on record, best options have kind of timeout. how long timeout is, depends on application. have client refresh lock regularly, , can create timeout shorter.
a improve solution might not lock @ all, check whether has changed info before saving changes. done using timestamp or version number in record updated. concept "optimistic locking".
however, works if possible conflicts relatively improbable. phone call center workers updating client records typical case, since hardly ever case 2 phone call center places talk same client @ same time. if ever happens, 1 of them error, , has re-load info , create changes again.
java javascript
No comments:
Post a Comment