Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-2809

Lock expires almost immediately

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.2
    • 2.2
    • locks
    • None

    Description

      When a timeoutHint other than Long.MAX_VALUE is given to the javax.jcr.lock.LockManager API:

      lock(String absPath, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerInfo)

      a timeoutTime in seconds will be computed as follows (o.a.j.core.lock.LockInfo#updateTimeoutTime):

      long now = (System.currentTimeMillis() + 999) / 1000; // round up
      this.timeoutTime = now + timeoutHint;

      the TimeoutHandler in o.a.j.core.lock.LockManagerImpl running every second will then check whether the timeout has expired (o.a.j.core.lock.LockInfo#isExpired):

      public boolean isExpired()

      { return timeoutTime != Long.MAX_VALUE && timeoutTime * 1000 > System.currentTimeMillis(); }

      Obviously, the latter condition is true from the very beginning. Replacing '>' with '<' or '<=' should do the trick.

      Attachments

        1. jcr-2809-lockTimeout.patch
          9 kB
          Thomas Mueller

        Activity

          People

            thomasm Thomas Mueller
            dpfister Dominique Pfister
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: