Ramesh Devaraj wrote:
I my use case I want minimize time between locking and unlocking.
1. I don't to lock the parent node than create a child node than
save and unlock it (here other threads working parallel has wait
for long time until it is unlocked)
2. If I create a child node than I am not able to lock its parent
(API throws the exception "Unable to lock node. Node has pending
changes")
this is simply how JCR works. you cannot create a lock on a node with
pending changes.
So I want create node which is attached/added to the workspace e.g.
in the memory
what you can do instead is create the node structure in a somewhat
private area where you can be sure that no other session interferes.
e.g. you could have a structure like this
+ home
+ user1
+ user2
+ ...
then let a user create the node structure under /home/user1, then lock
the parent node where you really want to add the content. e.g.
/global/stuff and then move the content from the user location to the
global one. In jackrabbit a move is a very cheap operation and will be
executed quite fast. That way the lock will only be short lived.
regards
marcel