bug 9827:AssertionError: Resource counts can not be negative

adding extra logging for resource count issues
This commit is contained in:
Murali Reddy 2011-05-13 20:17:51 +05:30
parent 349e0b3254
commit c63260e424
1 changed files with 10 additions and 0 deletions

View File

@ -232,6 +232,11 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
if (m_resourceCountLock.lock(120)) { // 2 minutes
try {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Incrementing the ResourceType." + type.toString() + " count for the account:" + accountId + " by " + numToIncrement);
}
_resourceCountDao.updateAccountCount(accountId, type, true, numToIncrement);
// on a per-domain basis, increment the count
@ -255,6 +260,11 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
if (m_resourceCountLock.lock(120)) { // 2 minutes
try {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Decrementing the ResourceType." + type.toString() + " count for the account:" + accountId + " by " + numToDecrement);
}
assert ((_resourceCountDao.getAccountCount(accountId, type) - numToDecrement) >= 0) : "Resource counts can not be negative. Check where we skipped increment.";
_resourceCountDao.updateAccountCount(accountId, type, false, numToDecrement);