- private void checkNotCanceled() {
- Preconditions.checkState(commitImpl != null, "Transaction was canceled.");
+ @Override
+ @SuppressWarnings("checkstyle:illegalcatch")
+ public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+ final AbstractDOMForwardedTransactionFactory<?> impl = IMPL_UPDATER.getAndSet(this, null);
+ checkRunning(impl);
+
+ final Collection<T> txns = getSubtransactions();
+ final Collection<DOMStoreThreePhaseCommitCohort> cohorts = new ArrayList<>(txns.size());
+
+ CheckedFuture<Void, TransactionCommitFailedException> ret;
+ try {
+ for (DOMStoreWriteTransaction txn : txns) {
+ cohorts.add(txn.ready());
+ }
+
+ ret = impl.submit(this, cohorts);
+ } catch (RuntimeException e) {
+ ret = Futures.immediateFailedCheckedFuture(
+ TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER.apply(e));
+ }
+ FUTURE_UPDATER.lazySet(this, ret);
+ return ret;