Skip to content

Commit 617d232

Browse files
author
Julien Hervot de Mattos Vaz
committed
Move DB access to end of method
1 parent 2dc5715 commit 617d232

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaManagerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,10 @@ protected boolean shouldCalculateUsageRecord(AccountVO accountVO, UsageVO usageR
360360

361361
@Override
362362
public boolean findConfigurationValue(AccountVO accountVO, ConfigKey<Boolean> key) {
363-
boolean result = Boolean.parseBoolean(getConfigValueOrDefaultValue(key));
364363
logger.trace("Searching configuration [{}] of account [{}] in its settings.", key.key(), accountVO);
365364
AccountDetailVO accountDetail = accountDetailsDao.findDetail(accountVO.getAccountId(), key.key());
366365
if (accountDetail != null) {
367-
result = Boolean.parseBoolean(accountDetail.getValue());
366+
boolean result = Boolean.parseBoolean(accountDetail.getValue());
368367
logger.trace("Using value [{}] found in account [{}] settings to configuration [{}].", result, accountVO, key.key());
369368
return result;
370369
}
@@ -373,11 +372,12 @@ public boolean findConfigurationValue(AccountVO accountVO, ConfigKey<Boolean> ke
373372
logger.trace("Searching for configuration [{}] of account [{}] in its domain [{}] settings.", key.key(), accountVO, accountVO.getDomainId());
374373
DomainDetailVO domainDetail = domainDetailsDao.findDetail(accountVO.getDomainId(), key.key());
375374
if (domainDetail != null) {
376-
result = Boolean.parseBoolean(domainDetail.getValue());
375+
boolean result = Boolean.parseBoolean(domainDetail.getValue());
377376
logger.trace("Using value [{}] found in domain [{}] settings to configuration [{}].", result, accountVO.getDomainId(), key.key());
378377
return result;
379378
}
380379
}
380+
boolean result = Boolean.parseBoolean(getConfigValueOrDefaultValue(key));
381381
logger.trace("Using default value [{}] to configuration [{}].", result, key.key());
382382
return result;
383383
}

0 commit comments

Comments
 (0)