Source:
private void saveDataToDb() { if (_saveVdsDynamic) { _vdsManager.updateDynamicData(_vds.getDynamicData()); if (refreshedCapabilities) { _vdsManager.updateNumaData(_vds); } } if (_saveVdsStatistics) { VdsStatistics stat = _vds.getStatisticsData(); _vdsManager.updateStatisticsData(stat); checkVdsMemoryThreshold(stat); checkVdsCpuThreshold(stat); checkVdsNetworkThreshold(stat); checkVdsSwapThreshold(stat); final List<VdsNetworkStatistics> statistics = new LinkedList<VdsNetworkStatistics>(); for (VdsNetworkInterface iface : _vds.getInterfaces()) { statistics.add(iface.getStatistics()); } if (!statistics.isEmpty()) { TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Void>() { @Override public Void runInTransaction() { getDbFacade().getInterfaceDao().massUpdateStatisticsForVds(statistics); return null; } }); } saveCpuStatisticsDataToDb(); saveNumaStatisticsDataToDb(); } getDbFacade().getVmDynamicDao().updateAllInBatch(_vmDynamicToSave.values()); getDbFacade().getVmStatisticsDao().updateAllInBatch(_vmStatisticsToSave.values()); final List<VmNetworkStatistics> allVmInterfaceStatistics = new LinkedList<VmNetworkStatistics>(); for (List<VmNetworkInterface> list : _vmInterfaceStatisticsToSave.values()) { for (VmNetworkInterface iface : list) { allVmInterfaceStatistics.add(iface.getStatistics()); } } getDbFacade().getVmNetworkStatisticsDao().updateAllInBatch(allVmInterfaceStatistics); getDbFacade().getDiskImageDynamicDao().updateAllWithoutImageId(_vmDiskImageDynamicToSave); getDbFacade().getLunDao().updateAllInBatch(vmLunDisksToSave); saveVmDevicesToDb(); saveVmGuestAgentNetworkDevices(); getVdsEventListener().addExternallyManagedVms(_externalVmsToAdd); }

Target:
private void saveDataToDb() { if (_saveVdsDynamic) { _vdsManager.updateDynamicData(_vds.getDynamicData()); if (refreshedCapabilities) { _vdsManager.updateNumaData(_vds); } } if (_saveVdsStatistics) { VdsStatistics stat = _vds.getStatisticsData(); _vdsManager.updateStatisticsData(stat); checkVdsMemoryThreshold(stat); checkVdsCpuThreshold(stat); checkVdsNetworkThreshold(stat); checkVdsSwapThreshold(stat); final List<VdsNetworkStatistics> statistics = new LinkedList<VdsNetworkStatistics>(); for (VdsNetworkInterface iface : _vds.getInterfaces()) { statistics.add(iface.getStatistics()); } if (!statistics.isEmpty()) { TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Void>() { @Override public Void runInTransaction() { getDbFacade().getInterfaceDao().massUpdateStatisticsForVds(statistics); return null; } }); } saveCpuStatisticsDataToDb(); saveNumaStatisticsDataToDb(); } getDbFacade().getVmDynamicDao().updateAllInBatch(_vmDynamicToSave.values()); getDbFacade().getVmStatisticsDao().updateAllInBatch(_vmStatisticsToSave.values()); final List<VmNetworkStatistics> allVmInterfaceStatistics = new LinkedList<VmNetworkStatistics>(); for (List<VmNetworkInterface> list : _vmInterfaceStatisticsToSave.values()) { for (VmNetworkInterface iface : list) { allVmInterfaceStatistics.add(iface.getStatistics()); } } getDbFacade().getVmNetworkStatisticsDao().updateAllInBatch(allVmInterfaceStatistics); getDbFacade().getDiskImageDynamicDao().updateAllDiskImageDynamicWithDiskId(_vmDiskImageDynamicToSave); getDbFacade().getLunDao().updateAllInBatch(vmLunDisksToSave); saveVmDevicesToDb(); saveVmGuestAgentNetworkDevices(); getVdsEventListener().addExternallyManagedVms(_externalVmsToAdd); }