+ final MapNode mapNode = ImmutableNodes.mapNodeBuilder(ID_INTS).build();
+
+ DOMDataWriteTransaction tx = txProvider.createTransaction();
+ // write only the top list
+ tx.merge(LogicalDatastoreType.CONFIGURATION, ID_INTS_YID, mapNode);
+ try {
+ tx.submit().checkedGet();
+ } catch (final OptimisticLockFailedException e) {
+ // when multiple write-transactions are executed concurrently we need to ignore this.
+ // If we get optimistic lock here it means id-ints already exists and we can continue.
+ LOG.debug("Got an optimistic lock when writing initial top level list element.", e);
+ } catch (final TransactionCommitFailedException e) {
+ LOG.warn("Unable to ensure IdInts list for id: {} exists.", id, e);
+ settableFuture.set(RpcResultBuilder.<WriteTransactionsOutput>failed()
+ .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", e).build());
+ return false;
+ }
+