[dna-issues] [JBoss JIRA] Commented: (DNA-541) Locking Implementation Does Not Support Timeouts

Brian Carothers (JIRA) jira-events at lists.jboss.org
Sat Dec 5 20:55:36 EST 2009


    [ https://jira.jboss.org/jira/browse/DNA-541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12498459#action_12498459 ] 

Brian Carothers commented on DNA-541:
-------------------------------------

The final piece is the ability to add a timeout for session-scoped and/or permanent locks.  This would allow the system to clean itself up if sessions get closed without calling logout or a coding error results in lost lock tokens for permanent locks.

Randall and I had an IRC discussion about this months ago where he suggested adding an expiry time to the lock record in /jcr:system/dna:locks and adding a thread that would periodically advance the time into the future for active sessions.  The tricky part is determining which sessions are active.  I was thinking about having each session create a ScheduledFuture task that would advance the expiry time for its own locks (if the session still existed), but I think it would be easier to just put a set of weak references to active sessions into the JcrRepository.  The algorithm would then be something like this:

let M := the repository's set of active sessions
for each lock L under /jcr:system/dna:locks
    if (L.isSessionScoped)
        if (L.lockExpiration < the current time)
            delete L from graph
            delete corresponding lock from WorkspaceLockManager
        else if (M.containsKey(L.sessionId))
            L.expiryTime += some interval

There would probably have to be some balancing in there between the frequency at which this task runs and the amount that the expiry time is advanced to handle things like clock-drift across a cluster or the task running behind on heavily loaded systems.

Any thoughts or feedback on this approach would be appreciated.  My big questions are: 

1.  Is this even worth doing?
2.  If it is worth doing, where should the scheduler (presumably a ScheduledExecutorService) live?  That's the kind of service that the DNA repository has provided to the JcrRepositories in the past, I think.


> Locking Implementation Does Not Support Timeouts
> ------------------------------------------------
>
>                 Key: DNA-541
>                 URL: https://jira.jboss.org/jira/browse/DNA-541
>             Project: DNA
>          Issue Type: Bug
>          Components: JCR
>            Reporter: Brian Carothers
>            Assignee: Brian Carothers
>             Fix For: 0.7
>
>         Attachments: DNA-541_admin_unlock.patch
>
>
> The locking implementation does not provide a means of expiring stale or old locks (other than having the original owner unlock them).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the dna-issues mailing list