JobLockService 使用什么策略来强制同步?
JobLockService 使用什么策略来强制同步?它会锁定整个存储库吗?或者还有另一种技术?
当我编写这样的代码时:
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);
正如您可以从该代码中注意到的那样,我使用 JobLockService 获取锁后会发生什么?它是否完全锁定存储库并阻止任何其他进程访问该存储库?
我问的是用于强制同步的实际技术。
另外,这里的 LockToken 是什么?这样做有什么好处?
预先感谢,非常感谢您的回复。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JobLockService
确实不会对存储到存储库中的实际内容设置任何锁定,更不用说锁定整个存储库了。成功调用JobLockService.getLock
后,任何线程都可以自由更新它想要编辑的任何节点。您的代码必须确保必须以受控并发执行的块首先尝试获取相同的锁。您创建的 LockToken 对象似乎没有用,可以删除。
JobLockService
does not put any lock on actual content stored into the repository, let alone lock the whole repository. After you successfully calledJobLockService.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.