- org.opendaylight.yangtools.yang.common.QName OL_ID = QName.create(OuterList.QNAME, "id");
- DOMTransactionChain chain = domDataBroker.createTransactionChain(this);
- DOMDataReadOnlyTransaction tx = domDataBroker.newReadOnlyTransaction();
-
- YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
- for (int l = 0; l < outerListElem; l++) {
- NormalizedNode<?,?> ret;
- YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, OL_ID, l));
- Optional<NormalizedNode<?,?>> optionalDataObject;
- CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> submitFuture = tx.read(LogicalDatastoreType.CONFIGURATION, yid);
- try {
- optionalDataObject = submitFuture.checkedGet();
- if (optionalDataObject != null && optionalDataObject.isPresent()) {
- ret = optionalDataObject.get();
- txOk++;
+ try (DOMDataTreeReadTransaction tx = domDataBroker.newReadOnlyTransaction()) {
+ for (int l = 0; l < outerListElem; l++) {
+ YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, olId, l));
+ Optional<NormalizedNode<?,?>> optionalDataObject;
+ FluentFuture<Optional<NormalizedNode<?, ?>>> submitFuture = tx.read(dsType, yid);
+ try {
+ optionalDataObject = submitFuture.get();
+ if (optionalDataObject != null && optionalDataObject.isPresent()) {
+ txOk++;
+ }
+ } catch (final InterruptedException | ExecutionException e) {
+ LOG.warn("failed to ....", e);
+ txError++;