jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msl...@email.cz
Subject Re: Re: Re: Any way how to remove node lock?
Date Mon, 06 Feb 2012 16:09:12 GMT
Hmm,

only way I found so far is to call remove on locked node. But it is just last resort.

One weird thing I found is that when I used:
if (node.isLocked()) {
  node.remove();
} else {
  node.setProperty
}

it throws exception about locked node when node.setProperty is called. I would expect if node
is locked node.isLocked() returns true.

Relevant call stack:
Caused by: javax.jcr.lock.LockException: Node locked.
	at org.apache.jackrabbit.core.lock.LockManagerImpl.checkLock(LockManagerImpl.java:734) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.lock.LockManagerImpl.checkLock(LockManagerImpl.java:713) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.lock.LockManagerImpl.checkLock(LockManagerImpl.java:700) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.lock.XALockManager.checkLock(XALockManager.java:174) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.ItemValidator.checkLock(ItemValidator.java:367) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.ItemValidator.checkCondition(ItemValidator.java:288) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.ItemValidator.checkModify(ItemValidator.java:248) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.AddMixinOperation.perform(AddMixinOperation.java:70) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.NodeImpl.addMixin(NodeImpl.java:902) [jackrabbit-core-2.2.9-noLogs.jar:]
	at org.apache.jackrabbit.core.NodeImpl.addMixin(NodeImpl.java:2306) [jackrabbit-core-2.2.9-noLogs.jar:]

For my use case I need only application scoped node locks ie. persistent only during application
run. Current node locking
is too strong especially when there is no easy way how to 'reset' locks when something goes
wrong.

Marek

> ------------ Původní zpráva ------------
> Od:  <mslama@email.cz>
> Předmět: Re: Re: Any way how to remove node lock?
> Datum: 06.2.2012 16:30:55
> ----------------------------------------
> 
> It looks I am helpless because I use:
> 
>     <bean id="credentials" class="javax.jcr.SimpleCredentials">
>         <constructor-arg index="0" value="admin"/>
>         <constructor-arg index="1">
>             <bean factory-bean="password" factory-method="toCharArray"/>
>         </constructor-arg>
>     </bean>
> 
>     <bean id="password" class="java.lang.String">
>         <constructor-arg index="0" value=""/>
>     </bean>
> 
> This is passed to repository.login for my development environment and it does
> look like admin account.
> 
> Marek
> > ------------ Původní zpráva ------------
> > Od: Mark Herman <MHerman@NBME.org>
> > Předmět: Re: Any way how to remove node lock?
> > Datum: 06.2.2012 16:15:24
> > ----------------------------------------
> > 
> > mslama wrote
> > > 
> > > 
> > > But from my first incorrect test I have now some locked nodes. Is there
> > > any wahy how to remove locks from nodes?
> > > 
> > > 
> > 
> > 
> > The only way I have found is to log in as the "admin" account.  That seems
> > to be able to clean up the locks without following the normal rules.  
> > 
> > FYI, you also have to be careful about not logging out. I found that if
> > somewhere you have code that doesn't result in a logout() or you get a hard
> > crash, that session will remain and even if you know the lock token, JR
> > won't let you add it to a 2nd session.
> > 
> > 
> > 
> > --
> > View this message in context:
> >
> http://jackrabbit.510166.n4.nabble.com/Any-way-how-to-remove-node-lock-tp4361516p4361534.html
> > Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
> > 
> > 
> > 
> 
> Marek Slama
> mslama@email.cz
> 
> 
> 

Marek Slama
mslama@email.cz

Mime
View raw message