You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by KÖLL Claus <C....@TIROL.GV.AT> on 2007/09/12 10:49:38 UTC
lock question
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"
i have also tried a lot of things with the lockmanager methods but till now
i cant remove the lock.
thanks for help
claus
Re: lock question
Posted by Stefan Guggisberg <st...@gmail.com>.
On 9/12/07, KÖLL Claus <C....@tirol.gv.at> wrote:
> if i login again i try this code ..
>
> LockManager lockManager = ((SessionImpl)session).getLockManager();
> lockManager.holdsLock((NodeImpl)foo);
> //returns true
>
> Lock myLock = lockManager.getLock((NodeImpl)foo);
> myLock.getLockOwner();
> //returns valid userid
>
> myLock.isSessionScoped();
> //returns true
>
> lockManager.isLockHolder(session, (NodeImpl)foo);
> //returns false
>
> myLock.getLockToken();
> //returns null !
did you read "8.4 Locking" in the jsr 170 spec?
you don't need to use jackrabbit internals, in fact i would
strongly discourage from using jackrabbit specific code.
you'll find everything you need in the JCR api.
cheers
stefan
>
> greets
> claus
>
> -----Ursprüngliche Nachricht-----
> Von: KÖLL Claus [mailto:C.KOELL@TIROL.GV.AT]
> Gesendet: Mittwoch, 12. September 2007 14:57
> An: users@jackrabbit.apache.org
> Betreff: AW: lock question
>
> hi stefan,
>
> first thanks for the infos.
> how can i remove the lock if i can not save the lock token from the first session.
>
> something like this ..
>
> session.getRootNode().getNode("path/to/lockable/node").lock(true, false);
> now log out ..
> login again and remove the lock .. how ?
>
> thanks
> claus
>
> -----Ursprüngliche Nachricht-----
> Von: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
> Gesendet: Mittwoch, 12. September 2007 14:33
> An: users@jackrabbit.apache.org
> Betreff: Re: lock question
>
> On 9/12/07, Carsten Ziegeler <cz...@apache.org> wrote:
> > Stefan Guggisberg wrote:
> > > 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();
> > >
> > >
> > Is it required to remove the lock token from the first session?
>
> if you log out the first session before you transfer the lock token, no.
> otherwise you'll have to remove it since only one session can hold
> a particular lock token.
>
> cheers
> stefan
>
> >
> > Carsten
> >
> > --
> > Carsten Ziegeler
> > cziegeler@apache.org
> >
>
AW: lock question
Posted by KÖLL Claus <C....@TIROL.GV.AT>.
if i login again i try this code ..
LockManager lockManager = ((SessionImpl)session).getLockManager();
lockManager.holdsLock((NodeImpl)foo);
//returns true
Lock myLock = lockManager.getLock((NodeImpl)foo);
myLock.getLockOwner();
//returns valid userid
myLock.isSessionScoped();
//returns true
lockManager.isLockHolder(session, (NodeImpl)foo);
//returns false
myLock.getLockToken();
//returns null !
greets
claus
-----Ursprüngliche Nachricht-----
Von: KÖLL Claus [mailto:C.KOELL@TIROL.GV.AT]
Gesendet: Mittwoch, 12. September 2007 14:57
An: users@jackrabbit.apache.org
Betreff: AW: lock question
hi stefan,
first thanks for the infos.
how can i remove the lock if i can not save the lock token from the first session.
something like this ..
session.getRootNode().getNode("path/to/lockable/node").lock(true, false);
now log out ..
login again and remove the lock .. how ?
thanks
claus
-----Ursprüngliche Nachricht-----
Von: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
Gesendet: Mittwoch, 12. September 2007 14:33
An: users@jackrabbit.apache.org
Betreff: Re: lock question
On 9/12/07, Carsten Ziegeler <cz...@apache.org> wrote:
> Stefan Guggisberg wrote:
> > 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();
> >
> >
> Is it required to remove the lock token from the first session?
if you log out the first session before you transfer the lock token, no.
otherwise you'll have to remove it since only one session can hold
a particular lock token.
cheers
stefan
>
> Carsten
>
> --
> Carsten Ziegeler
> cziegeler@apache.org
>
Re: AW: AW: lock question
Posted by Angela Schreiber <an...@day.com>.
hi claus
> i have also posted a jira issue for this problem
> https://issues.apache.org/jira/browse/JCR-1136
ok. but that would only be an extension to the reference
implementation. we we may take into consideration
if the expert group of JSR 283 is not in favour of
the proposed extension. however, i would consider this
a valuable extension of the specification itself.
> i think we can mark my issue as duplicate ..
... of http://issues.apache.org/jira/browse/JCR-779.
there julian add quite some details for a potential impl.
kind regards
angela
AW: AW: lock question
Posted by KÖLL Claus <C....@TIROL.GV.AT>.
hi angela,
i have also posted a jira issue for this problem
https://issues.apache.org/jira/browse/JCR-1136
i think we can mark my issue as duplicate ..
BR,
claus
-----Ursprüngliche Nachricht-----
Von: Angela Schreiber [mailto:anchela@day.com]
Gesendet: Mittwoch, 03. Oktober 2007 12:57
An: users@jackrabbit.apache.org
Betreff: Re: AW: lock question
Julian Reschke wrote:
> I think what the WebDAV layer *should* do is create a lock with a
> timeout. Unfortunately timeouts aren't defined in JSR-170. Maybe you
> should request this as a new feature in JSR-283...
i created a feature request for jsr-283.
in fact this has been discussed in the jackrabbit
mailing lists before (see also JCR-779)and i run into that problem
more than once.
angela
Re: AW: lock question
Posted by Angela Schreiber <an...@day.com>.
Julian Reschke wrote:
> I think what the WebDAV layer *should* do is create a lock with a
> timeout. Unfortunately timeouts aren't defined in JSR-170. Maybe you
> should request this as a new feature in JSR-283...
i created a feature request for jsr-283.
in fact this has been discussed in the jackrabbit
mailing lists before (see also JCR-779)and i run into that problem
more than once.
angela
lock question
Posted by KÖLL Claus <C....@TIROL.GV.AT>.
Hi christoph,
thanks for the information !
this hack is for me at the moment the solution ;-)
thanks
claus
-----Ursprüngliche Nachricht-----
Von: news [mailto:news@sea.gmane.org] Im Auftrag von Christoph Kiehl
Gesendet: Donnerstag, 13. September 2007 13:23
An: users@jackrabbit.apache.org
Betreff: Re: AW: AW: lock question
KÖLL Claus wrote:
> ok i will create a jira issue ..
>
> but i need a way to remove the lock from a node now.
> we have files with locks in the production environment and this is a big problem.
AFAIK, there is a "locks" file in your workspace directory (e.g.
<repohome>/workspaces/default/locks). If you shutdown your repository you can
edit this file and remove the uuids in question. You could as well delete the
file to get rid of all locks. If you now startup your repository the locks
should be gone. I would keep a backup of this file just in case.
Not sure if this helps in your situation and I would like to mention that this
is quite hacky not supported etc.
But we should definitely support this operation in the future.
Cheers,
Christoph
Re: AW: AW: lock question
Posted by Christoph Kiehl <ch...@sulu3000.de>.
KÖLL Claus wrote:
> ok i will create a jira issue ..
>
> but i need a way to remove the lock from a node now.
> we have files with locks in the production environment and this is a big problem.
AFAIK, there is a "locks" file in your workspace directory (e.g.
<repohome>/workspaces/default/locks). If you shutdown your repository you can
edit this file and remove the uuids in question. You could as well delete the
file to get rid of all locks. If you now startup your repository the locks
should be gone. I would keep a backup of this file just in case.
Not sure if this helps in your situation and I would like to mention that this
is quite hacky not supported etc.
But we should definitely support this operation in the future.
Cheers,
Christoph
AW: AW: lock question
Posted by KÖLL Claus <C....@TIROL.GV.AT>.
ok i will create a jira issue ..
but i need a way to remove the lock from a node now.
we have files with locks in the production environment and this is a big problem.
greets
claus
-----Ursprüngliche Nachricht-----
Von: Julian Reschke [mailto:julian.reschke@gmx.de]
Gesendet: Donnerstag, 13. September 2007 11:42
An: users@jackrabbit.apache.org
Betreff: Re: AW: lock question
KÖLL Claus wrote:
> can anybody help me with this scenario ?
>
> i have read the specification and i see no solution to myproblem.
> if the webdav impl creates a non sessionscoped lock
> -> DAVResourceImpl.lock(LockInfo)
> on a node and then do not remove it (only if the normal worklow is interrupted)
> i have a node in the repository that can not be unlocked ..
>
> greets
> claus
Yes.
I think what the WebDAV layer *should* do is create a lock with a
timeout. Unfortunately timeouts aren't defined in JSR-170. Maybe you
should request this as a new feature in JSR-283...
Best regards, Julian
Re: AW: lock question
Posted by Julian Reschke <ju...@gmx.de>.
KÖLL Claus wrote:
> can anybody help me with this scenario ?
>
> i have read the specification and i see no solution to myproblem.
> if the webdav impl creates a non sessionscoped lock
> -> DAVResourceImpl.lock(LockInfo)
> on a node and then do not remove it (only if the normal worklow is interrupted)
> i have a node in the repository that can not be unlocked ..
>
> greets
> claus
Yes.
I think what the WebDAV layer *should* do is create a lock with a
timeout. Unfortunately timeouts aren't defined in JSR-170. Maybe you
should request this as a new feature in JSR-283...
Best regards, Julian
AW: lock question
Posted by KÖLL Claus <C....@TIROL.GV.AT>.
can anybody help me with this scenario ?
i have read the specification and i see no solution to myproblem.
if the webdav impl creates a non sessionscoped lock
-> DAVResourceImpl.lock(LockInfo)
on a node and then do not remove it (only if the normal worklow is interrupted)
i have a node in the repository that can not be unlocked ..
greets
claus
-----Ursprüngliche Nachricht-----
Von: KÖLL Claus [mailto:C.KOELL@TIROL.GV.AT]
Gesendet: Mittwoch, 12. September 2007 15:47
An: users@jackrabbit.apache.org
Betreff: AW: lock question
i get the lock problems with the webdav servlet
in some rarely situations like a user quits the ms word by the taskmanager
the webdav servlet can not release the lock from the node and
so i have a node with a lock and i can not remove it
what can i do ?
claus
-----Ursprüngliche Nachricht-----
Von: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
Gesendet: Mittwoch, 12. September 2007 15:08
An: users@jackrabbit.apache.org
Betreff: Re: lock question
On 9/12/07, KÖLL Claus <C....@tirol.gv.at> wrote:
> hi stefan,
>
> first thanks for the infos.
> how can i remove the lock if i can not save the lock token from the first session.
>
> something like this ..
>
> session.getRootNode().getNode("path/to/lockable/node").lock(true, false);
> now log out ..
> login again and remove the lock .. how ?
you need to retrieve the lock token *before* the session logs out,
e.g. by calling
Lock lock = ....lock(true, false);
String token = lock.getLockToken();
or
// about to log out...
String[] tokens = session.getLockTokens();
>
> thanks
> claus
>
> -----Ursprüngliche Nachricht-----
> Von: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
> Gesendet: Mittwoch, 12. September 2007 14:33
> An: users@jackrabbit.apache.org
> Betreff: Re: lock question
>
> On 9/12/07, Carsten Ziegeler <cz...@apache.org> wrote:
> > Stefan Guggisberg wrote:
> > > 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();
> > >
> > >
> > Is it required to remove the lock token from the first session?
>
> if you log out the first session before you transfer the lock token, no.
> otherwise you'll have to remove it since only one session can hold
> a particular lock token.
>
> cheers
> stefan
>
> >
> > Carsten
> >
> > --
> > Carsten Ziegeler
> > cziegeler@apache.org
> >
>
AW: lock question
Posted by KÖLL Claus <C....@TIROL.GV.AT>.
i get the lock problems with the webdav servlet
in some rarely situations like a user quits the ms word by the taskmanager
the webdav servlet can not release the lock from the node and
so i have a node with a lock and i can not remove it
what can i do ?
claus
-----Ursprüngliche Nachricht-----
Von: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
Gesendet: Mittwoch, 12. September 2007 15:08
An: users@jackrabbit.apache.org
Betreff: Re: lock question
On 9/12/07, KÖLL Claus <C....@tirol.gv.at> wrote:
> hi stefan,
>
> first thanks for the infos.
> how can i remove the lock if i can not save the lock token from the first session.
>
> something like this ..
>
> session.getRootNode().getNode("path/to/lockable/node").lock(true, false);
> now log out ..
> login again and remove the lock .. how ?
you need to retrieve the lock token *before* the session logs out,
e.g. by calling
Lock lock = ....lock(true, false);
String token = lock.getLockToken();
or
// about to log out...
String[] tokens = session.getLockTokens();
>
> thanks
> claus
>
> -----Ursprüngliche Nachricht-----
> Von: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
> Gesendet: Mittwoch, 12. September 2007 14:33
> An: users@jackrabbit.apache.org
> Betreff: Re: lock question
>
> On 9/12/07, Carsten Ziegeler <cz...@apache.org> wrote:
> > Stefan Guggisberg wrote:
> > > 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();
> > >
> > >
> > Is it required to remove the lock token from the first session?
>
> if you log out the first session before you transfer the lock token, no.
> otherwise you'll have to remove it since only one session can hold
> a particular lock token.
>
> cheers
> stefan
>
> >
> > Carsten
> >
> > --
> > Carsten Ziegeler
> > cziegeler@apache.org
> >
>
Re: lock question
Posted by Stefan Guggisberg <st...@gmail.com>.
On 9/12/07, KÖLL Claus <C....@tirol.gv.at> wrote:
> hi stefan,
>
> first thanks for the infos.
> how can i remove the lock if i can not save the lock token from the first session.
>
> something like this ..
>
> session.getRootNode().getNode("path/to/lockable/node").lock(true, false);
> now log out ..
> login again and remove the lock .. how ?
you need to retrieve the lock token *before* the session logs out,
e.g. by calling
Lock lock = ....lock(true, false);
String token = lock.getLockToken();
or
// about to log out...
String[] tokens = session.getLockTokens();
>
> thanks
> claus
>
> -----Ursprüngliche Nachricht-----
> Von: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
> Gesendet: Mittwoch, 12. September 2007 14:33
> An: users@jackrabbit.apache.org
> Betreff: Re: lock question
>
> On 9/12/07, Carsten Ziegeler <cz...@apache.org> wrote:
> > Stefan Guggisberg wrote:
> > > 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();
> > >
> > >
> > Is it required to remove the lock token from the first session?
>
> if you log out the first session before you transfer the lock token, no.
> otherwise you'll have to remove it since only one session can hold
> a particular lock token.
>
> cheers
> stefan
>
> >
> > Carsten
> >
> > --
> > Carsten Ziegeler
> > cziegeler@apache.org
> >
>
AW: lock question
Posted by KÖLL Claus <C....@TIROL.GV.AT>.
hi stefan,
first thanks for the infos.
how can i remove the lock if i can not save the lock token from the first session.
something like this ..
session.getRootNode().getNode("path/to/lockable/node").lock(true, false);
now log out ..
login again and remove the lock .. how ?
thanks
claus
-----Ursprüngliche Nachricht-----
Von: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
Gesendet: Mittwoch, 12. September 2007 14:33
An: users@jackrabbit.apache.org
Betreff: Re: lock question
On 9/12/07, Carsten Ziegeler <cz...@apache.org> wrote:
> Stefan Guggisberg wrote:
> > 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();
> >
> >
> Is it required to remove the lock token from the first session?
if you log out the first session before you transfer the lock token, no.
otherwise you'll have to remove it since only one session can hold
a particular lock token.
cheers
stefan
>
> Carsten
>
> --
> Carsten Ziegeler
> cziegeler@apache.org
>
Re: lock question
Posted by Stefan Guggisberg <st...@gmail.com>.
On 9/12/07, Carsten Ziegeler <cz...@apache.org> wrote:
> Stefan Guggisberg wrote:
> > 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();
> >
> >
> Is it required to remove the lock token from the first session?
if you log out the first session before you transfer the lock token, no.
otherwise you'll have to remove it since only one session can hold
a particular lock token.
cheers
stefan
>
> Carsten
>
> --
> Carsten Ziegeler
> cziegeler@apache.org
>
Re: lock question
Posted by Carsten Ziegeler <cz...@apache.org>.
Stefan Guggisberg wrote:
> 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();
>
>
Is it required to remove the lock token from the first session?
Carsten
--
Carsten Ziegeler
cziegeler@apache.org
Re: lock question
Posted by Stefan Guggisberg <st...@gmail.com>.
On 9/12/07, KÖLL Claus <C....@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
>
>