jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: Unlocking: Node not locked by this session
Date Sat, 24 May 2008 18:19:01 GMT
Hi,

On Sat, May 24, 2008 at 6:12 PM, viz06 <vijaykumarsharma_1999@yahoo.com> wrote:
> I have a very simple setup using spring module jcrTemplate. I am able to lock
> a node using
>
> Lock nodeLock = jcrTemplate.getNodeByUUID(<myUUID>).lock(false, false);
>
> and this is how I am attempting unlocking
>
> jcrTemplate.getSessionFactory().getSession().addLockToken(nodeLock
> .getLockToken());
>
> jcrTemplate.getNodeByUUID(<myUUID>).unlock();

Do you still have a reference to the original Node instance that you
locked. The easiest way to unlock it is to call unlock() on that node
instance as it's still associated with the session that originally
locked the node.

Otherwise, try the following code snippet, as the lock token needs to
be associated with the same session that does the unlocking:

    Node node = jcrTemplate.getNodeByUUID(<myUUID>);
    node.getSession().addLockTiken(<lockToken>);
    node.unlock();

BR,

Jukka Zitting

Mime
View raw message