This commit is contained in:
Lucio Lelii 2015-11-17 17:22:22 +00:00
parent 4445ec9df7
commit e7d89ededf
1 changed files with 8 additions and 5 deletions

View File

@ -119,13 +119,12 @@ public abstract class AccountingPersistenceBackendFactory {
logger.debug("The {} for scope {} is {}. Is time to rediscover if there is another possibility.", logger.debug("The {} for scope {} is {}. Is time to rediscover if there is another possibility.",
AccountingPersistenceBackend.class.getSimpleName(), scope, actual.getClass().getSimpleName()); AccountingPersistenceBackend.class.getSimpleName(), scope, actual.getClass().getSimpleName());
lock.lock();
try { try {
logger.trace("Renewing Last check Timestamp. The next one will be {}", now);
fallbackLastCheck.put(scope, now);
lastCheckTimestamp = fallbackLastCheck.get(scope);
AccountingPersistenceBackend discoveredPersistenceBackend = discoverAccountingPersistenceBackend(scope); AccountingPersistenceBackend discoveredPersistenceBackend = discoverAccountingPersistenceBackend(scope);
lock.lock();
if(discoveredPersistenceBackend!=null){ if(discoveredPersistenceBackend!=null){
// Passing the aggregator to the new AccountingPersistenceBackend // Passing the aggregator to the new AccountingPersistenceBackend
// so that the buffered records will be persisted with the new method // so that the buffered records will be persisted with the new method
@ -143,6 +142,10 @@ public abstract class AccountingPersistenceBackendFactory {
} }
lock.unlock(); lock.unlock();
return discoveredPersistenceBackend; return discoveredPersistenceBackend;
}else{
logger.trace("Renewing Last check Timestamp. The next one will be {}", now);
fallbackLastCheck.put(scope, now);
lastCheckTimestamp = fallbackLastCheck.get(scope);
} }
}finally { }finally {
lock.unlock(); lock.unlock();
@ -159,7 +162,7 @@ public abstract class AccountingPersistenceBackendFactory {
return actual; return actual;
} }
protected static synchronized AccountingPersistenceBackend getPersistenceBackend() { protected static AccountingPersistenceBackend getPersistenceBackend() {
String scope = ScopeProvider.instance.get(); String scope = ScopeProvider.instance.get();
if(scope==null){ if(scope==null){