Adding a connection renewal to refresh connection when to much fallback occurs
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@131783 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5a92c474db
commit
d1763925cf
|
@ -16,10 +16,14 @@ import org.gcube.documentstore.records.Record;
|
|||
*/
|
||||
public class AccountingPersistence {
|
||||
|
||||
protected PersistenceBackend persistenceBackend;
|
||||
protected String scope;
|
||||
|
||||
protected AccountingPersistence(String scope){
|
||||
persistenceBackend = PersistenceBackendFactory.getPersistenceBackend(scope);
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
private PersistenceBackend getAccountingPersistence(){
|
||||
return PersistenceBackendFactory.getPersistenceBackend(this.scope);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,18 +37,18 @@ public class AccountingPersistence {
|
|||
*/
|
||||
public void account(final Record record) throws InvalidValueException {
|
||||
try {
|
||||
persistenceBackend.account(record);
|
||||
getAccountingPersistence().account(record);
|
||||
} catch (org.gcube.documentstore.exception.InvalidValueException e) {
|
||||
throw new InvalidValueException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void flush(long timeout, TimeUnit timeUnit) throws Exception {
|
||||
persistenceBackend.flush(timeout, timeUnit);
|
||||
getAccountingPersistence().flush(timeout, timeUnit);
|
||||
}
|
||||
|
||||
public void close() throws Exception{
|
||||
persistenceBackend.close();
|
||||
getAccountingPersistence().close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue