@Override
public boolean reconcileConfiguration(final OvsdbConnectionManager connectionManagerOfDevice) {
+ CheckedFuture<Optional<Topology>, ReadFailedException> readTopologyFuture;
InstanceIdentifier<Topology> topologyInstanceIdentifier = SouthboundMapper.createTopologyInstanceIdentifier();
- ReadOnlyTransaction tx = reconciliationManager.getDb().newReadOnlyTransaction();
-
- // find all bridges of the specific device in the config data store
- // TODO: this query is not efficient. It retrieves all the Nodes in the datastore, loop over them and look for
- // the bridges of specific device. It is mre efficient if MDSAL allows query nodes using wildcard on node id
- // (ie: ovsdb://uuid/<device uuid>/bridge/*) r attributes
- CheckedFuture<Optional<Topology>, ReadFailedException> readTopologyFuture =
- tx.read(CONFIGURATION, topologyInstanceIdentifier);
+ try (ReadOnlyTransaction tx = reconciliationManager.getDb().newReadOnlyTransaction()) {
+ // find all bridges of the specific device in the config data store
+ // TODO: this query is not efficient. It retrieves all the Nodes in the datastore, loop over them and look
+ // for the bridges of specific device. It is mre efficient if MDSAL allows query nodes using wildcard on
+ // node id (ie: ovsdb://uuid/<device uuid>/bridge/*) r attributes
+ readTopologyFuture = tx.read(CONFIGURATION, topologyInstanceIdentifier);
+ }
Futures.addCallback(readTopologyFuture, new FutureCallback<Optional<Topology>>() {
@Override
public void onSuccess(@Nullable Optional<Topology> optionalTopology) {