kavitha ramasamy wrote:
> I need to make a lock on a particular bean . Once if I locked the relevant
> lock details are entered into the table. If the lock is released then the
> row is deleted, another user can use that bean.
> I need a solution in the following cases.
>
> 1)In case of abnormal session closing
> such as powerfailure ...., I need to remove the lock entry from the table.
>
> 2) if a session time out(for particular time) , the lock has to be
> automatically realeased(entry has to be released). other user can make a
> lock on that bean.
>
> please give me a solution to solve the above cases.
It seems that your implementation of a lock needs to involve two fields:
who locked it, and when. The who lets you determine who is allowed to
unlock it, and the when allows you to "time out" the lock. When you
check isLocked() you need to not only see if a lock exists, but also the
age of it. If it has timed out then you may remove or replace it.
/Rickard
--
Rickard �berg
@home: +46 13 177937
Email: [EMAIL PROTECTED]
Homepage: http://www-und.ida.liu.se/~ricob684
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".