From 72e16be98c2167e84da2ff9ae63eeb1f8be886b7 Mon Sep 17 00:00:00 2001 From: Abhinandan Prateek Date: Thu, 23 Jul 2015 09:03:36 +0530 Subject: [PATCH] quota: transaction commit when a account is processed --- .../src/org/apache/cloudstack/quota/QuotaManagerImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaManagerImpl.java b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaManagerImpl.java index 09961de09a8..482978d4798 100644 --- a/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaManagerImpl.java +++ b/plugins/database/quota/src/org/apache/cloudstack/quota/QuotaManagerImpl.java @@ -71,9 +71,9 @@ public class QuotaManagerImpl extends ManagerBase implements QuotaManager { private TimeZone _usageTimezone; private int _aggregationDuration = 0; - static BigDecimal s_hoursInMonth = new BigDecimal(30 * 24); - static BigDecimal s_minutesInMonth = new BigDecimal(30 * 24 * 60); - static BigDecimal s_gb = new BigDecimal(1024 * 1024 * 1024); + final static BigDecimal s_hoursInMonth = new BigDecimal(30 * 24); + final static BigDecimal s_minutesInMonth = new BigDecimal(30 * 24 * 60); + final static BigDecimal s_gb = new BigDecimal(1024 * 1024 * 1024); public QuotaManagerImpl() { super(); @@ -104,7 +104,6 @@ public class QuotaManagerImpl extends ManagerBase implements QuotaManager { boolean jobResult = false; TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); try { - // get all the active accounts for which there is usage List accounts = _accountDao.listAll(); for (AccountVO account : accounts) { // START ACCOUNT @@ -206,6 +205,7 @@ public class QuotaManagerImpl extends ManagerBase implements QuotaManager { } }// balance processed } // END ACCOUNT + txn.commit(); jobResult = true; } catch (Exception e) { s_logger.error("Quota Manager error", e);