jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@gmail.com>
Subject Re: lock question
Date Wed, 12 Sep 2007 12:20:35 GMT
On 9/12/07, KÖLL Claus <C.KOELL@tirol.gv.at> wrote:
> hi,
>
> if i lock a node with
> node.lock(true, false) so that i have a non sessionscoped lock.
>
> the question is how can i remove that lock ?
>
> if i try to do this
> node.unlock()
> i get always "Node not locked by session"

you need to transfer the lock token from the session that created the
lock to the new session., e.g. like this:

            Lock lock =

sessionA.getRootNode().getNode("path/to/lockable/node").lock(true,
false);
            String token = lock.getLockToken();
            sessionA.removeLockToken(token);
            ...
            sessionB.addLockToken(token);
            sessionB.getRootNode().getNode("path/to/lockable/node").unlock();


for more information please see "8.4 Locking" in the jsr 170 spec.

cheers
stefan

>
> i have also tried a lot of things with the lockmanager methods but till now
> i cant remove the lock.
>
> thanks for help
> claus
>
>

Mime
View raw message