0
我正在用多線程在Titan中創建一個頂點。 這裏是我的代碼Titan中的多線程拋出異常
嘗試連接到泰坦,指定架構,然後添加頂點。
g = TitanFactory.open("/conf/titan-cassandra.properties");
TitanManagement mgmt = g.getManagementSystem();
final PropertyKey userid = mgmt.makePropertyKey("userid").dataType(Integer.class).make();
TitanGraphIndex namei = mgmt.buildIndex("userid",Vertex.class).addKey(userid).unique().buildCompositeIndex();
mgmt.setConsistency(namei, ConsistencyModifier.LOCK);
mgmt.commit();
然後我打電話的功能添加頂點
多個線程訪問功能添加頂點這需要輸入參數 - 隨機生成的唯一編號(entityPK)
tx1 = g.newTransaction();
Vertex user_ver = tx1.addVertexWithLabel("user");
user_ver.setProperty("userid",entityPK);
//Adding other properties for vertex
tx1.commit();`
我讀了拋出的異常是因爲沒有指定LOCK。但即使指定了LOCK,也會引發異常。
com.thinkaurelius.titan.core.TitanException:無法持久性