use of org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification in project mdsal by opendaylight.
the class SnapshotBackedWriteTransaction method merge.
@SuppressWarnings("checkstyle:IllegalCatch")
@Override
public void merge(final YangInstanceIdentifier path, final NormalizedNode data) {
checkNotReady();
final DataTreeModification tree = mutableTree;
LOG.debug("Tx: {} Merge: {}:{}", getIdentifier(), path, data);
try {
tree.merge(path, data);
// FIXME: Add checked exception
} catch (Exception e) {
LOG.error("Tx: {}, failed to merge {}:{} in {}", getIdentifier(), path, data, tree, e);
// Rethrow original ones if they are subclasses of RuntimeException or Error
Throwables.throwIfUnchecked(e);
// FIXME: Introduce proper checked exception
throw new IllegalArgumentException("Illegal input data.", e);
}
}
use of org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification in project mdsal by opendaylight.
the class SnapshotBackedWriteTransaction method ready.
@SuppressWarnings("checkstyle:IllegalCatch")
@Override
public DOMStoreThreePhaseCommitCohort ready() {
@SuppressWarnings("unchecked") final TransactionReadyPrototype<T> wasReady = READY_UPDATER.getAndSet(this, null);
checkState(wasReady != null, "Transaction %s is no longer open", getIdentifier());
LOG.debug("Store transaction: {} : Ready", getIdentifier());
final DataTreeModification tree = mutableTree;
TREE_UPDATER.lazySet(this, null);
try {
tree.ready();
return wasReady.transactionReady(this, tree, null);
} catch (RuntimeException e) {
LOG.debug("Store transaction: {}: unexpected failure when readying", getIdentifier(), e);
return wasReady.transactionReady(this, tree, e);
}
}
use of org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification in project yangtools by opendaylight.
the class InMemoryDataTreeBenchmark method write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark.
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark() throws DataValidationFailedException {
for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) {
final DataTreeModification modification = begin();
modification.write(OUTER_LIST_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]);
commit(modification);
}
}
use of org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification in project yangtools by opendaylight.
the class InMemoryDataTreeBenchmark method write10KSingleNodeWithTenInnerItemsInCommitPerWriteBenchmark.
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write10KSingleNodeWithTenInnerItemsInCommitPerWriteBenchmark() throws DataValidationFailedException {
for (int outerListKey = 0; outerListKey < OUTER_LIST_10K; ++outerListKey) {
final DataTreeModification modification = begin();
modification.write(OUTER_LIST_PATHS[outerListKey], OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]);
commit(modification);
}
}
use of org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification in project yangtools by opendaylight.
the class InMemoryDataTreeBenchmark method write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark.
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark() throws DataValidationFailedException {
final DataTreeModification modification = begin();
for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) {
modification.write(OUTER_LIST_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]);
}
commit(modification);
}
Aggregations