cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot perform operation since the node is locked

mohammed_amr
Champ in-the-making
Champ in-the-making
Dear Gurus.

I have a problem when i'm trying to use the LockService and my problem is clear at the following line
// Prepare Organization Sequence
Node organizationSeq = new Node(SequenceUtil.prepareSequence(
                  SequenceUtil.ORGANIZATION_SEQUENCE_NODE_NAME_STRING,
                  nodeService, searchService));
// Lock Organization Sequence
lockService.lock(organizationSeq.getNodeRef(), LockType.NODE_LOCK);

// Add Organization Sequence By One
            SequenceUtil.addCurrentSequence(organizationSeq.getNodeRef(), nodeService);
The Exception has been thrown as:

org.alfresco.service.cmr.lock.NodeLockedException: 06240003 Cannot perform operation since the node (id:fc97c145-cea4-4ce6-8c0d-fdb406790edc) is locked.

But i need to work on the locked node, is there any missing code must be written such as serviceRegistry.getWorkingCopy() or etc.

I cannot find any help in the context of that problem.

can you guide help me to understand the functionality of the lockService or jobLockService.

Thanks
Mohammed Amr
Senior System Developer
Digital Series Co.
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
The lock service locks a particular node for editing by a particular user.   So for example if the node is unlocked "fred" can lock it and and then change it,  in the meantime "bill" can't edit it.   As and when "fred" unlocks the node then bill can lock it and edit it.

The JobLockService is what you want for sequential access.    It locks a particular qname and tells you whether you hold the lock or waits for the lock to be released by someone else.     You would build a qname for each of your sequences.

mohammed_amr
Champ in-the-making
Champ in-the-making
I have one content model define sequence and by it i made a node for maintaining the organization sequence and another node for maintaining the position sequence.

Could i use the "lock service" than use "job lock service" ? if yes i saw tow version of "lock service" one of them with lock method like this

lock(NodeRef nodeRef, LockType lockType).

where lock type is the type of the lock either read or write or node itself.
node ref is the node itself to be locked.

But your documentation talks about other thing, it is talk about method like this

lock(NodeRef nodeRef, String username,LockType lockType).

where username is the current user and other still remain as is.

But if i must use joblockservice, then i will make two content models one of them to the organization sequence and other for position sequence. ?

I that correct ?

also, I think that i have 3.4.b as development environment and 3.4.d as documentation  :roll:  which is confuse me, is that correct ?

And I need to ask What the difference between lock the node and lock the qname ? and can you please give me an example about JobLockService.

Thanks
Mohammed Amr
Senior System Developer
Digital Series. Co.