jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msl...@email.cz
Subject Re: Re: Re: Re: Any way how to remove node lock?
Date Mon, 06 Feb 2012 17:01:33 GMT
I found another problem with transferring lock token between sessions:

        Lock lock = null;
        Session session;
        session = sessionFactory.newSession();
        try {
            lock = tryLockNode(session, companyPath);
            logger.debug("LockToken:" + lock.getLockToken());
        } finally {
        session = sessionFactory.newSession();
        LockManager lockManager = null;
        try {
            if (lock != null) {
                lockManager = session.getWorkspace().getLockManager();
            return doUpdateCompany(session, company, sendMessage, containerId, companyPath);
        } finally {
            if (lockManager != null) {

with this code I still get Caused by: javax.jcr.lock.LockException: Node not locked by session:
	at org.apache.jackrabbit.core.lock.LockManagerImpl.checkUnlock(LockManagerImpl.java:773)
	at org.apache.jackrabbit.core.lock.LockManagerImpl.checkUnlock(LockManagerImpl.java:754)
	at org.apache.jackrabbit.core.lock.XALockManager.checkUnlock(XALockManager.java:207) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.lock.SessionLockManager.unlock(SessionLockManager.java:202)
when lockManager.unlock(companyPath);

So it looks like transfering lock token between sessions does not work as I expected. To get
lock I use:
lock = lockManager.lock(nodePath, false, false, Long.MAX_VALUE, "");

For now I give up using JCR node locking.
As I said before I assumed I must use separate session to lock node so that another sessions
will see this lock in my
JBoss env with XATransaction support.

I checked LockerManagerImpl.checkUnlock and its javadoc says:
Default implementation allows unlocking to the lock holder only.

I am looking at Jackrabbit sources now to see if I find anything.


> ------------ Původní zpráva ------------
> Od: Mark Herman <MHerman@NBME.org>
> Předmět: Re: Re: Re: Any way how to remove node lock?
> Datum: 06.2.2012 17:17:01
> ----------------------------------------
> I tried using locks for my application, but ultimately had to take them out. 
> Using admin seemed to solve my problems, but it was not an option to hard
> code admin credentials to create new sessions when needed to address them.
> Locks in Jackrabbit seem a bit too "serious" (perhaps not JR's fault but
> JCR).  It would be nice if you could at least grant access to override locks
> without a lock token.
> For my application I eventually stopped using locking and implemented the
> functionality i needed in my layer above JR.  Luckily for me, that is a
> single java api so it was pretty easy, maybe it's an option for you. 
> --
> View this message in context:
> http://jackrabbit.510166.n4.nabble.com/Any-way-how-to-remove-node-lock-tp4361516p4361768.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Marek Slama

View raw message