本文整理了Java中org.janusgraph.core.JanusGraph.newTransaction()
方法的一些代码示例,展示了JanusGraph.newTransaction()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JanusGraph.newTransaction()
方法的具体详情如下:
包路径:org.janusgraph.core.JanusGraph
类名称:JanusGraph
方法名:newTransaction
[英]Opens a new thread-independent JanusGraphTransaction.
The transaction is open when it is returned but MUST be explicitly closed by calling org.janusgraph.core.JanusGraphTransaction#commit()or org.janusgraph.core.JanusGraphTransaction#rollback() when it is no longer needed.
Note, that this returns a thread independent transaction object. It is not necessary to call this method to use Blueprint's standard transaction framework which will automatically start a transaction with the first operation on the graph.
[中]打开一个新的独立于线程的JanusGraphTransaction。
事务在返回时打开,但必须通过调用org显式关闭。janusgraph。果心JanusGraphTransaction#commit()或org。janusgraph。果心JanusGraphTransaction不再需要时回滚()。
注意,这将返回一个独立于线程的事务对象。使用Blueprint的标准事务框架不需要调用此方法,该框架将在图形上的第一个操作中自动启动事务。
代码示例来源:origin: JanusGraph/janusgraph
JanusGraphTransaction tx1 = graph.newTransaction();
JanusGraphTransaction tx2 = graph.newTransaction();
job.run(tx1);
job.run(tx2);
代码示例来源:origin: JanusGraph/janusgraph
JanusGraphTransaction tx = graph.newTransaction();
代码示例来源:origin: Netflix/ndbench
@Override
public String readSingle(String key) throws Exception {
JanusGraphTransaction tx = useJanusgraphTransaction ? graph.newTransaction() : null;
try {
return readSingleInternal(key, tx);
} finally {
if (tx != null)
tx.close();
}
}
代码示例来源:origin: Netflix/ndbench
/**
* Perform a bulk read operation
* @return a list of response codes
* @throws Exception
*/
public List<String> readBulk(final List<String> keys) throws Exception {
List<String> responses = new ArrayList<>(keys.size());
JanusGraphTransaction transaction = useJanusgraphTransaction ? graph.newTransaction() : null;
try {
for (String key : keys) {
String response = readSingleInternal(key, transaction);
responses.add(response);
}
} finally {
if (transaction != null)
transaction.close();
}
return responses;
}
代码示例来源:origin: IBM/janusgraph-utils
@Override
public void run() {
log.info("Starting new thread " + myID);
// Start new graph transaction
graphTransaction = getGraph().newTransaction();
getRecords().forEachRemaining(new Consumer<Map<String, String>>() {
@Override
public void accept(Map<String, String> record) {
try {
acceptRecord(record);
} catch (Exception e) {
log.error("Thread " + myID + ". Exception during record import.", e);
}
}
});
graphTransaction.commit();
graphTransaction.close();
log.info("Finished thread " + myID);
notifyListener(WorkerListener.State.Done);
}
代码示例来源:origin: IBM/janusgraph-utils
graphTransaction.commit();
graphTransaction.close();
graphTransaction = getGraph().newTransaction();
traversal = graphTransaction.traversal();
代码示例来源:origin: IBM/janusgraph-utils
@Override
public void run() {
log.info("Starting new thread " + myID);
// Start new graph transaction
graphTransaction = getGraph().newTransaction();
this.traversal = graphTransaction.traversal();
getRecords().forEachRemaining(new Consumer<Map<String, String>>() {
@Override
public void accept(Map<String, String> record) {
try {
acceptRecord(record);
} catch (Exception e) {
log.error("Thread " + myID + ". Exception during record import.", e);
}
}
});
graphTransaction.commit();
graphTransaction.close();
graphTransaction = null;
log.info("Finished thread " + myID);
notifyListener(WorkerListener.State.Done);
}
}
代码示例来源:origin: IBM/janusgraph-utils
graphTransaction.commit();
graphTransaction.close();
graphTransaction = getGraph().newTransaction();
内容来源于网络,如有侵权,请联系作者删除!