[英]Issues with updating vertex property in Titan graph database
In my Titan graph db, JobLockStatus
can be (F)ree or (B)usy based on some condition. 在我的Titan图db中,
JobLockStatus
可以是(F)ree或(B)usy基于某些条件。
N number of jobs are trying to alter the joblockstatus
at the same time for RequestId=203. 对于RequestId = 203,N个作业正在尝试同时更改
joblockstatus
。 I am using below query to update the value: 我使用下面的查询来更新值:
GraphTraversal<Vertex, Vertex> ab =
traversalSource.V().has("RequestJob", "RequestId", 203).has("JobLockStatus","F").property("JobLockStatus", "B").iterate();
updating the value of JobLockStatus
from "F" to "B" should happen only once, by any one of the job, at any time. 将
JobLockStatus
的值从“F”更新为“B”只能在任何一个任务中随时发生一次。 But in my case, many jobs are altering the value. 但就我而言,许多工作正在改变价值。 How can I avoid such a concurrency issue?
我怎样才能避免这种并发问题?
Kindly help me to resolve the problem. 请帮我解决问题。
解决了这个并发问题..通过在jobLockStatus..so上随时使用consistencyModifier.Lock,只有一个作业可以锁定joblockstatus并更新它..当两个并行作业试图锁定时,只有一个作业会锁定它,其他作业将获取permanantLockException ...然后使用java中的try catch处理异常...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.