本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.util.TransactionException类的典型用法代码示例。如果您正苦于以下问题:Java TransactionException类的具体用法?Java TransactionException怎么用?Java TransactionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransactionException类属于org.apache.tinkerpop.gremlin.structure.util包,在下文中一共展示了TransactionException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doCommit
import org.apache.tinkerpop.gremlin.structure.util.TransactionException; //导入依赖的package包/类
@Override
protected void doCommit() throws TransactionException {
// current session
Neo4JSession session = Neo4JGraph.this.currentSession();
// commit transaction
session.commit();
}
示例2: doRollback
import org.apache.tinkerpop.gremlin.structure.util.TransactionException; //导入依赖的package包/类
@Override
protected void doRollback() throws TransactionException {
// current session
Neo4JSession session = Neo4JGraph.this.currentSession();
// rollback transaction
session.rollback();
}
示例3: doCommit
import org.apache.tinkerpop.gremlin.structure.util.TransactionException; //导入依赖的package包/类
@Override
public void doCommit() throws TransactionException {
try (Neo4jTx tx = threadLocalTx.get()) {
tx.success();
} catch (Exception ex) {
throw new TransactionException(ex);
} finally {
threadLocalTx.remove();
}
}
示例4: doRollback
import org.apache.tinkerpop.gremlin.structure.util.TransactionException; //导入依赖的package包/类
@Override
public void doRollback() throws TransactionException {
try (Neo4jTx tx = threadLocalTx.get()) {
tx.failure();
} catch (Exception e) {
throw new TransactionException(e);
} finally {
threadLocalTx.remove();
}
}
示例5: doCommit
import org.apache.tinkerpop.gremlin.structure.util.TransactionException; //导入依赖的package包/类
@Override
protected void doCommit() throws TransactionException {
if (!isOpen()) {
return;
}
try {
if (supportsBatchMode() && this.threadLocalTx.get().getBatchManager().isInBatchMode()) {
getBatchManager().flush();
}
Connection connection = this.threadLocalTx.get().getConnection();
if (this.beforeCommitFunction != null) {
this.beforeCommitFunction.doBeforeCommit();
}
connection.commit();
connection.setAutoCommit(true);
if (this.afterCommitFunction != null) {
this.afterCommitFunction.doAfterCommit();
}
this.threadLocalPreparedStatementTx.get().close();
connection.close();
} catch (Exception e) {
this.rollback();
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException(e);
}
} finally {
if (this.threadLocalTx.get() != null) {
this.threadLocalTx.get().clear();
this.threadLocalTx.remove();
}
this.threadLocalPreparedStatementTx.remove();
}
}