synchronized void commit(final DataTreeCandidate candidate) { dataTree.commit(candidate); changePublisher.publishChange(candidate); }
@Override public ListenableFuture<Void> commit() { Preconditions.checkState(candidate != null, "Attempted to commit an aborted transaction"); LOG.debug("Commiting candidate {}", candidate); dataTree.commit(candidate); // publish this change for listeners changePublisher.publishChange(candidate); return SUCCESSFUL_FUTURE; } }
@Override public void commit(final DataTreeCandidate dataTreeCandidate) { LOG.trace("Commit detected"); delegateDependency.commit(dataTreeCandidate); LOG.debug("Delegate commit successful. Persisting data"); // TODO(HONEYCOMB-163): doing full read and full write might not be the fastest way of persisting data here final DataTreeSnapshot dataTreeSnapshot = delegateDependency.takeSnapshot(); // TODO this can be handled in background by a dedicated thread + a limited blocking queue // TODO enable configurable granularity for persists. Maybe doing write on every modification is too much // and we could do bulk persist persister.persistCurrentData(dataTreeSnapshot.readNode(YangInstanceIdentifier.EMPTY)); }
synchronized void commit(final DataTreeCandidate candidate) { dataTree.commit(candidate); changePublisher.publishChange(candidate); ResolveDataChangeEventsTask.create(candidate, listenerTree).resolve(dataChangeListenerNotificationManager); } }
private void commit(final DataTreeModification modification) throws DataValidationFailedException { modification.ready(); datastore.validate(modification); datastore.commit(datastore.prepare(modification)); } }
@Override public final void commit() throws TranslationException { final DataTreeContext candidateContext = prepareCandidateContext(modification); validateCandidate(candidateContext); processCandidate(candidateContext); dataTree.commit(candidateContext.getCandidate()); }
private NormalizedNodeAggregator combine() throws DataValidationFailedException { final DataTreeModification mod = dataTree.takeSnapshot().newModification(); for (final Optional<NormalizedNode<?,?>> node : nodes) { if (node.isPresent()) { mod.merge(rootIdentifier, node.get()); } } mod.ready(); dataTree.validate(mod); final DataTreeCandidate candidate = dataTree.prepare(mod); dataTree.commit(candidate); return this; }
@Override public DataTree create(final DataTreeConfiguration treeConfig, final SchemaContext initialSchemaContext, final NormalizedNodeContainer<?, ?, ?> initialRoot) throws DataValidationFailedException { final DataTree ret = create(treeConfig, initialSchemaContext, false); final DataTreeModification mod = ret.takeSnapshot().newModification(); mod.write(YangInstanceIdentifier.EMPTY, initialRoot); mod.ready(); ret.validate(mod); final DataTreeCandidate candidate = ret.prepare(mod); ret.commit(candidate); return ret; }
@Override public DataTree create(final DataTreeConfiguration treeConfig, final SchemaContext initialSchemaContext, final NormalizedNodeContainer<?, ?, ?> initialRoot) throws DataValidationFailedException { final DataTree ret = create(treeConfig, initialSchemaContext, false); final DataTreeModification mod = ret.takeSnapshot().newModification(); mod.write(YangInstanceIdentifier.EMPTY, initialRoot); mod.ready(); ret.validate(mod); final DataTreeCandidate candidate = ret.prepare(mod); ret.commit(candidate); return ret; }