本文整理汇总了Java中com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreTransaction.rollback方法的典型用法代码示例。如果您正苦于以下问题:Java StoreTransaction.rollback方法的具体用法?Java StoreTransaction.rollback怎么用?Java StoreTransaction.rollback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreTransaction
的用法示例。
在下文中一共展示了StoreTransaction.rollback方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreTransaction; //导入方法依赖的package包/类
public static<R> R execute(Transactional<R> exe, TransactionalProvider provider, TimestampProvider times) throws BackendException {
StoreTransaction txh = null;
try {
txh = provider.openTx();
if (!txh.getConfiguration().hasCommitTime()) txh.getConfiguration().setCommitTime(times.getTime());
return exe.call(txh);
} catch (BackendException e) {
if (txh!=null) txh.rollback();
txh=null;
throw e;
} finally {
if (txh!=null) txh.commit();
}
}
示例2: execute
import com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreTransaction; //导入方法依赖的package包/类
public TitanManagement.IndexJobFuture execute() throws BackendException {
Preconditions.checkArgument(job!=null,"Need to specify a job to execute");
Preconditions.checkArgument(StringUtils.isNotBlank(dbName),"Need to specify a database to execute against");
Preconditions.checkArgument(times!=null,"Need to configure the timestamp provider for this job");
StandardBaseTransactionConfig.Builder txBuilder = new StandardBaseTransactionConfig.Builder();
txBuilder.timestampProvider(times);
Configuration scanConfig = manager.getFeatures().getScanTxConfig();
if (Configuration.EMPTY != graphConfiguration) {
scanConfig = null == scanConfig ?
graphConfiguration :
new MergedConfiguration(graphConfiguration, scanConfig);
}
if (null != scanConfig) {
txBuilder.customOptions(scanConfig);
}
// if (!txOptions.isEmpty()) {
// ModifiableConfiguration writeConf = GraphDatabaseConfiguration.buildConfiguration();
// for (Map.Entry<String,Object> confEntry : txOptions.entrySet()) {
// writeConf.set(
// (ConfigOption<Object>) ConfigElement.parse(ROOT_NS, confEntry.getKey()).element,
// confEntry.getValue());
// }
// Configuration customConf = writeConf;
// if (configuration!=Configuration.EMPTY) {
// customConf = new MergedConfiguration(writeConf, configuration);
//
// }
// txBuilder.customOptions(customConf);
// }
StoreTransaction storeTx = manager.beginTransaction(txBuilder.build());
KeyColumnValueStore kcvs = manager.openDatabase(dbName);
openStores.add(kcvs);
try {
StandardScannerExecutor executor = new StandardScannerExecutor(job, finishJob, kcvs, storeTx,
manager.getFeatures(), numProcessingThreads, workBlockSize, jobConfiguration, graphConfiguration);
addJob(jobId,executor);
new Thread(executor).start();
return executor;
} catch (Throwable e) {
storeTx.rollback();
throw e;
}
}