@Override public CheckedFuture<Void, TransactionCommitFailedException> submit() { return delegate().submit(); }
public synchronized boolean commitRunningTransaction(DOMDataReadWriteTransaction tx) throws DocumentedException { allOpenReadWriteTransactions.remove(tx); CheckedFuture<Void, TransactionCommitFailedException> future = tx.submit(); try { future.checkedGet(); } catch (TransactionCommitFailedException e) { LOG.debug("Transaction {} failed on", tx, e); throw new DocumentedException("Transaction commit failed on " + e.getMessage() + " " + netconfSessionIdForReporting, ErrorType.application, ErrorTag.operation_failed, ErrorSeverity.error); } return true; }
public synchronized boolean commitRunningTransaction(DOMDataReadWriteTransaction tx) throws NetconfDocumentedException { allOpenReadWriteTransactions.remove(tx); CheckedFuture<Void, TransactionCommitFailedException> future = tx.submit(); try { future.checkedGet(); } catch (TransactionCommitFailedException e) { LOG.debug("Transaction {} failed on", tx, e); throw new NetconfDocumentedException("Transaction commit failed on " + e.getMessage() + " " + netconfSessionIdForReporting, ErrorType.application, ErrorTag.operation_failed, ErrorSeverity.error); } return true; }
/** * Process a ready transaction. The caller needs to ensure that * each transaction is seen only once by this method. * * @param tx Transaction which needs processing. */ @GuardedBy("this") private void processTransaction(@Nonnull final PingPongTransaction tx) { if (failed) { LOG.debug("Cancelling transaction {}", tx); tx.getTransaction().cancel(); return; } LOG.debug("Submitting transaction {}", tx); if (!INFLIGHT_UPDATER.compareAndSet(this, null, tx)) { LOG.warn("Submitting transaction {} while {} is still running", tx, inflightTx); } Futures.addCallback(tx.getTransaction().submit(), new FutureCallback<Void>() { @Override public void onSuccess(final Void result) { transactionSuccessful(tx, result); } @Override public void onFailure(final Throwable t) { transactionFailed(tx, t); } }); }
public synchronized boolean commitTransaction() throws NetconfDocumentedException { if (!getCandidateTransaction().isPresent()) { //making empty commit without prior opened transaction, just return true LOG.debug("Making commit without open candidate transaction for session {}", netconfSessionIdForReporting); return true; } CheckedFuture<Void, TransactionCommitFailedException> future = candidateTransaction.submit(); try { future.checkedGet(); } catch (TransactionCommitFailedException e) { LOG.debug("Transaction {} failed on", candidateTransaction, e); throw new NetconfDocumentedException("Transaction commit failed on " + e.getMessage() + " " + netconfSessionIdForReporting, ErrorType.application, ErrorTag.operation_failed, ErrorSeverity.error); } allOpenReadWriteTransactions.remove(candidateTransaction); candidateTransaction = null; return true; }
@Override public CheckedFuture<Void, TransactionCommitFailedException> submit() { if (AuthzServiceImpl.isAuthorized(ActionType.Submit)) { return domDataReadWriteTransaction.submit(); } TransactionCommitFailedException e = new TransactionCommitFailedException( "Unauthorized User"); return Futures.immediateFailedCheckedFuture(e); }
public synchronized boolean commitTransaction() throws DocumentedException { if (!getCandidateTransaction().isPresent()) { //making empty commit without prior opened transaction, just return true LOG.debug("Making commit without open candidate transaction for session {}", netconfSessionIdForReporting); return true; } CheckedFuture<Void, TransactionCommitFailedException> future = candidateTransaction.submit(); try { future.checkedGet(); } catch (TransactionCommitFailedException e) { LOG.debug("Transaction {} failed on", candidateTransaction, e); final String cause = e.getCause() != null ? (" Cause: " + e.getCause().getMessage()) : ""; throw new DocumentedException("Transaction commit failed on " + e.getMessage() + " " + netconfSessionIdForReporting + cause, ErrorType.application, ErrorTag.operation_failed, ErrorSeverity.error); } finally { allOpenReadWriteTransactions.remove(candidateTransaction); candidateTransaction = null; } return true; }
private CheckedFuture<Void, TransactionCommitFailedException> putDataViaTransaction( final DOMDataBroker domDataBroker, final LogicalDatastoreType datastore, final YangInstanceIdentifier path, final NormalizedNode<?, ?> payload, final SchemaContext schemaContext) { DOMDataReadWriteTransaction transaction = domDataBroker.newReadWriteTransaction(); LOG.trace("Put " + datastore.name() + " via Restconf: {} with payload {}", path, payload); if (!ensureParentsByMerge(datastore, path, transaction, schemaContext)) { transaction.cancel(); transaction = domDataBroker.newReadWriteTransaction(); } transaction.put(datastore, path, payload); return transaction.submit(); }
return transaction.submit();