Always Close all the MDSAL
Read Transactions after use Transaction has not been
closed for ReadOnlyTransaction which leads to
unnecessary delay in destroying the shard
traction actors (in case of remote reads). This would
lead to memory leak and can also cause delay in creating
data tree snapshots for reads/writes. As a solution
tx.close() is been added to all ReadOnlyTransaction.
Change-Id: I3977f708ae3427d2f371c228d6ba4d773e9d74cd
Signed-off-by: Surendar Raju <surendar.raju@ericsson.com>
return new RemoteMcastMacsBuilder(remoteMcastMacs).setLocatorSet(new ArrayList<>(locators)).build();
} catch (ReadFailedException e) {
LOG.error("Failed to read the macs {}", iid);
return new RemoteMcastMacsBuilder(remoteMcastMacs).setLocatorSet(new ArrayList<>(locators)).build();
} catch (ReadFailedException e) {
LOG.error("Failed to read the macs {}", iid);
+ } finally {
+ transaction.close();
sn = tx.read(LogicalDatastoreType.CONFIGURATION, id).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
sn = tx.read(LogicalDatastoreType.CONFIGURATION, id).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
+ } finally {
+ tx.close();
LOG.warn("failed to get counter request data from DB");
return RpcResultBuilder.<GetElementCountersByHandlerOutput>failed()
.withError(ErrorType.APPLICATION, "failed to get counter request data from DB").buildFuture();
LOG.warn("failed to get counter request data from DB");
return RpcResultBuilder.<GetElementCountersByHandlerOutput>failed()
.withError(ErrorType.APPLICATION, "failed to get counter request data from DB").buildFuture();
+ } finally {
+ tx.close();
}
GetElementCountersByHandlerOutputBuilder gecbhob = new GetElementCountersByHandlerOutputBuilder();
}
GetElementCountersByHandlerOutputBuilder gecbhob = new GetElementCountersByHandlerOutputBuilder();
LOG.warn("failed to get counter request data from DB");
return RpcResultBuilder.<CleanAllElementCounterRequestsOutput>failed()
.withError(ErrorType.APPLICATION, "failed to get counter request data from DB").buildFuture();
LOG.warn("failed to get counter request data from DB");
return RpcResultBuilder.<CleanAllElementCounterRequestsOutput>failed()
.withError(ErrorType.APPLICATION, "failed to get counter request data from DB").buildFuture();
+ } finally {
+ tx.close();
}
return RpcResultBuilder.<CleanAllElementCounterRequestsOutput>success().buildFuture();
}
}
return RpcResultBuilder.<CleanAllElementCounterRequestsOutput>success().buildFuture();
}
}
} catch (InterruptedException | ExecutionException e) {
return false;
}
} catch (InterruptedException | ExecutionException e) {
return false;
+ } finally {
+ roTransaction.close();
LOG.trace("Received VpnInterface update event: original={}, update={}", original, update);
LOG.info("update: VPN Interface update event - intfName {} on dpn {} oldVpn {} newVpn {}", update.getName(),
update.getDpnId(), original.getVpnInstanceNames(), update.getVpnInstanceNames());
LOG.trace("Received VpnInterface update event: original={}, update={}", original, update);
LOG.info("update: VPN Interface update event - intfName {} on dpn {} oldVpn {} newVpn {}", update.getName(),
update.getDpnId(), original.getVpnInstanceNames(), update.getVpnInstanceNames());
+ if (original.equals(update)) {
+ LOG.info("update: original {} update {} are same. No update required.", original, update);
+ return;
+ }
final String vpnInterfaceName = update.getName();
final BigInteger dpnId = InterfaceUtils.getDpnForInterface(ifaceMgrRpcService, vpnInterfaceName);
LOG.info("VPN Interface update event - intfName {}", vpnInterfaceName);
final String vpnInterfaceName = update.getName();
final BigInteger dpnId = InterfaceUtils.getDpnForInterface(ifaceMgrRpcService, vpnInterfaceName);
LOG.info("VPN Interface update event - intfName {}", vpnInterfaceName);