jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gamba <holger.bre...@handelshof.de>
Subject Re: Own nodes with mix:lockable
Date Fri, 21 Aug 2009 06:55:48 GMT

Ok, that's correct. But the behaviour is the same as before, when I login
with a new session:

... 

// only with this snippet unlocking is performed
//nodeToLock.unlock();		
sessionLocal.logout();
sessionLocal = null;
			
// After logout, we have to create a new session to check the locking.
// Does only make sense in multiple transactions?
sessionLocal = repository.login (new SimpleCredentials("..",
"..".toCharArray()), "default");
			
// Get node to update ...
Node rootNode2 = sessionLocal.getRootNode();
Node nodeFree  = rootNode2.getNode("HMG");
			
assertFalse("Node is still logged, after session-logout",
nodeFree.isLocked());
sessionLocal.logout();

=> Exception: Node (nodeFree) is still locked. I expected that the lock
would be released
after session-logout because the sessionScoped-Param is ste to true.


So at all, must I lock my Nodes on concurrent updates?
I have a j2ee-environment and retreiving a session per request.
It could be possible, that two clients add or update the same
node.

Is there any trouble to expect in addition to the "lost-update-problem"?

If I understand it right (spec 8.4.10) a lock is only necessary and useful
over more than one transaction. But the updates only made in one transaction
and one instance of my session-bean. At the end of the bean-method
the session will be saved an performs a logout. After that the transaction
is committed. And after that the changes are persistent.

Thx
Gamba



Alexander Klimetschek wrote:
> 
> On Thu, Aug 20, 2009 at 9:58 AM, Gamba<holger.breuer@handelshof.de> wrote:
>>        // stop node-locking on logout(), because of  session-scoped lock
>> ... I
>> thought ...
>>        session.save();
>>        session.logout();
>>
>>        // LockExcpetion is thrown
>>        assertFalse("Node is still logged, after session-logout",
>> nodeToLock.isLocked());
>> }
> 
> I think the error lies in this test: after logging out, the node
> objects are not valid for usage anymore. To test it properly, create a
> new session, re-fetch the node in question and then check the
> isLocked() method.
> 
> Regards,
> Alex
> 
> -- 
> Alexander Klimetschek
> alexander.klimetschek@day.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Own-nodes-with-mix%3Alockable-tp25056308p25075027.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message