Using ITaskLock*

Hi all,

I am trying to use the ITaskLock classes, but I have a problem with the lock valid time setting. This is the documentation I was able to obtain.

/**

  • Acquires distributed lock for the given task. Lock is identified by source. Lock will be valid specified time.
  • If there is an active lock on the given task it will wait specified time
  • @param sourceURI source URI for the lock
  • @param taskURI task to be locks
    * @param validTime time in millis the lock will be valid
  • @param waitTime waiting time to acquire a lock (0 - immediately exit if lock can not be obtained)
  • @return acquired lock instance or null if unable to acquire a lock
  • @throws PortalException
    */
    ITaskLock acquireLock(IURI sourceURI, IURI taskURI, long validTime, long waitTime) throws PortalException;

I create the lock using validTime = 120000 (2 minutes).

ITaskLock lock = TaskHelper.getTaskLockingService().acquireLock(context.getUserID(), lockUri, 120000, 0);

At this point I would expect that after two minutes, when I try to get the lock I get nothing

ITaskLock lock = TaskHelper.getTaskLockingService().getLock(lockUri);

However, the lock object still exists and is still valid:

lock.isExpired(); => returns false.

So my question is :

Does anyone know for sure how the lock actually behaves? And how to have a lock automatically released after some time (validTime).

Thanx

Hi Teodor,
i must admit that i have never seen this class (I could not find this in the docu either). I would say that this is a question that could be addressed by support.

best regards
Javier