0
votes

What is the strategy used by JobLockService to enforce the synchronization ? Does it lock the whole Repository? or there is another technique?

When i write a code such that :

String lockString = jobLockService.getLock(QName.createQName(Prefix,LocalName, Resolver));
LockToken lockToken = new LockToken();
lockToken.set(lockString);
// Something going here such as create a node or update or delete
// another somethign processes here
jobLockService.releaseLock(lockString);

As you can notice from that code i use JobLockService What is happening once the lock is acquired ? Does it lock the repository at all and prevents any other prcoesses from accessing the repository ?

I'm asking about actual techniques used to enforece the synchronization.

Also, What is about LockToken here ? what is the benefit from it ?

Thanks in advance, you replies are very highly appreciated.

1

1 Answers

2
votes

JobLockService does not put any lock on actual content stored into the repository, let alone lock the whole repository. After you successfully called JobLockService.getLock, any thread is free to update whichever node it wants to edit. It is your code that must ensure that blocks that have to execute with a controlled concurrency are first trying to obtain the same lock.

That LockToken object you create seems of no use and can be dropped.