}
private static final Logger LOG = LoggerFactory.getLogger(TransactionProxy.class);
- private static final DeleteOperation ROOT_DELETE_OPERATION = new DeleteOperation(YangInstanceIdentifier.empty());
+ private static final DeleteOperation ROOT_DELETE_OPERATION = new DeleteOperation(YangInstanceIdentifier.of());
private final Map<String, AbstractTransactionContextWrapper> txContextWrappers = new TreeMap<>();
private final AbstractTransactionContextFactory<?> txContextFactory;
private FluentFuture<Optional<NormalizedNode>> readAllData() {
final var actorUtils = getActorUtils();
return RootScatterGather.gather(actorUtils, actorUtils.getConfiguration().getAllShardNames().stream()
- .map(shardName -> singleShardRead(shardName, YangInstanceIdentifier.empty())));
+ .map(shardName -> singleShardRead(shardName, YangInstanceIdentifier.of())));
}
@Override
if (!rootData.isEmpty()) {
RootScatterGather.scatterTouched(rootData, this::wrapperFromRootChild).forEach(
scattered -> scattered.shard().maybeExecuteTransactionOperation(
- new MergeOperation(YangInstanceIdentifier.empty(), scattered.container())));
+ new MergeOperation(YangInstanceIdentifier.of(), scattered.container())));
}
}
RootScatterGather.scatterAll(rootData, this::wrapperFromRootChild,
getActorUtils().getConfiguration().getAllShardNames().stream().map(this::wrapperFromShardName)).forEach(
scattered -> scattered.shard().maybeExecuteTransactionOperation(
- new WriteOperation(YangInstanceIdentifier.empty(), scattered.container())));
+ new WriteOperation(YangInstanceIdentifier.of(), scattered.container())));
}
private void executeModification(final TransactionModificationOperation operation) {
LOG.debug("Tx {} Readying {} components for commit", getIdentifier(), txContextWrappers.size());
- final AbstractThreePhaseCommitCohort<?> ret;
- switch (txContextWrappers.size()) {
- case 0:
- ret = NoOpDOMStoreThreePhaseCommitCohort.INSTANCE;
- break;
- case 1:
+ final AbstractThreePhaseCommitCohort<?> ret = switch (txContextWrappers.size()) {
+ case 0 -> NoOpDOMStoreThreePhaseCommitCohort.INSTANCE;
+ case 1 -> {
final Entry<String, AbstractTransactionContextWrapper> e = Iterables.getOnlyElement(
txContextWrappers.entrySet());
- ret = createSingleCommitCohort(e.getKey(), e.getValue());
- break;
- default:
- ret = createMultiCommitCohort();
- }
-
+ yield createSingleCommitCohort(e.getKey(), e.getValue());
+ }
+ default -> createMultiCommitCohort();
+ };
txContextFactory.onTransactionReady(getIdentifier(), ret.getCohortFutures());
final Throwable debugContext = getDebugContext();
}
private AbstractTransactionContextWrapper wrapperFromRootChild(final PathArgument childId) {
- return wrapperFromShardName(shardNameFromIdentifier(YangInstanceIdentifier.create(childId)));
+ return wrapperFromShardName(shardNameFromIdentifier(YangInstanceIdentifier.of(childId)));
}
private AbstractTransactionContextWrapper wrapperFromShardName(final String shardName) {