refs #1282: New Accounting: IS-Collector doesn't start correctly after upgrade to ghn 6.0.0
https://support.d4science.org/issues/1282 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@120301 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4b9bbd779e
commit
7121248817
|
@ -116,6 +116,7 @@ public abstract class AccountingPersistenceBackendFactory {
|
||||||
if( (lastCheckTimestamp + FALLBACK_RETRY_TIME) <= now ){
|
if( (lastCheckTimestamp + FALLBACK_RETRY_TIME) <= now ){
|
||||||
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());
|
||||||
|
|
||||||
AccountingPersistenceBackend discoveredPersistenceBackend = discoverAccountingPersistenceBackend(scope);
|
AccountingPersistenceBackend discoveredPersistenceBackend = discoverAccountingPersistenceBackend(scope);
|
||||||
|
|
||||||
synchronized (accountingPersistenceBackends) {
|
synchronized (accountingPersistenceBackends) {
|
||||||
|
@ -123,25 +124,36 @@ public abstract class AccountingPersistenceBackendFactory {
|
||||||
Long reCheckTimestamp = fallbackLastCheck.get(scope);
|
Long reCheckTimestamp = fallbackLastCheck.get(scope);
|
||||||
if(lastCheckTimestamp.compareTo(reCheckTimestamp)!=0){
|
if(lastCheckTimestamp.compareTo(reCheckTimestamp)!=0){
|
||||||
// Someone else arrived here before. Stopping to try to
|
// Someone else arrived here before. Stopping to try to
|
||||||
logger.debug("Someone else arrived here before. Stopping to try to rediscover AccountingPersistenceBackend");
|
logger.debug("Someone else arrived here before. Stopping to try to rediscover AccountingPersistenceBackend and getting the current");
|
||||||
return actual;
|
return accountingPersistenceBackends.get(scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
fallbackLastCheck.put(scope, now);
|
fallbackLastCheck.put(scope, now);
|
||||||
if(discoveredPersistenceBackend!=null){
|
if(discoveredPersistenceBackend!=null){
|
||||||
// Passing the aggregator to the new AccountingPersistenceBackend
|
/*
|
||||||
// so that the buffered records will be persisted with the new method
|
* Passing the aggregator to the new AccountingPersistenceBackend
|
||||||
|
* so that the buffered records will be persisted with the
|
||||||
|
* new method
|
||||||
|
*
|
||||||
|
*/
|
||||||
discoveredPersistenceBackend.setAggregationScheduler(actual.getAggregationScheduler());
|
discoveredPersistenceBackend.setAggregationScheduler(actual.getAggregationScheduler());
|
||||||
|
|
||||||
// Removing timestamp wich is no more needed
|
// Removing timestamp which is no more needed
|
||||||
fallbackLastCheck.remove(scope);
|
fallbackLastCheck.remove(scope);
|
||||||
accountingPersistenceBackends.put(scope, discoveredPersistenceBackend);
|
accountingPersistenceBackends.put(scope, discoveredPersistenceBackend);
|
||||||
try {
|
|
||||||
actual.close();
|
/*
|
||||||
} catch (Exception e) {
|
* Not needed because close has no effect. Removed to
|
||||||
logger.error("Error closing {} for scope {} which has been substituted with {}.",
|
* prevent problem in cases of future changes.
|
||||||
actual.getClass().getSimpleName(), scope,
|
* try {
|
||||||
discoveredPersistenceBackend.getClass().getSimpleName(), e);
|
* actual.close();
|
||||||
}
|
* } catch (Exception e) {
|
||||||
|
* logger.error("Error closing {} for scope {} which has been substituted with {}.",
|
||||||
|
* actual.getClass().getSimpleName(), scope,
|
||||||
|
* discoveredPersistenceBackend.getClass().getSimpleName(), e);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
return discoveredPersistenceBackend;
|
return discoveredPersistenceBackend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,7 +196,6 @@ public abstract class AccountingPersistenceBackendFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
persistence = accountingPersistenceBackends.get(scope);
|
|
||||||
if(persistence instanceof FallbackPersistenceBackend){
|
if(persistence instanceof FallbackPersistenceBackend){
|
||||||
persistence = rediscoverAccountingPersistenceBackend(persistence, scope);
|
persistence = rediscoverAccountingPersistenceBackend(persistence, scope);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue