Merged from branch version 3.4 of release 4.13

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@173920 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2018-11-02 11:36:39 +00:00
parent 7f3ce5e96f
commit 92e4d99c47
2 changed files with 6 additions and 5 deletions

View File

@ -21,7 +21,7 @@ public class AccountingPersistence {
this.context = context; this.context = context;
} }
private PersistenceBackend getAccountingPersistence(){ private PersistenceBackend getPersistenceBackend(){
return PersistenceBackendFactory.getPersistenceBackend(this.context); return PersistenceBackendFactory.getPersistenceBackend(this.context);
} }
@ -36,14 +36,14 @@ public class AccountingPersistence {
*/ */
public void account(final Record record) throws InvalidValueException { public void account(final Record record) throws InvalidValueException {
try { try {
getAccountingPersistence().account(record); getPersistenceBackend().account(record);
} catch (org.gcube.documentstore.exception.InvalidValueException e) { } catch (org.gcube.documentstore.exception.InvalidValueException e) {
throw new InvalidValueException(e); throw new InvalidValueException(e);
} }
} }
public void flush() throws Exception { public void flush() throws Exception {
getAccountingPersistence().flush(); getPersistenceBackend().flush();
} }
/** /**
@ -58,11 +58,11 @@ public class AccountingPersistence {
} }
public void close() throws Exception{ public void close() throws Exception{
getAccountingPersistence().close(); getPersistenceBackend().close();
} }
public boolean isConnectionActive() throws Exception { public boolean isConnectionActive() throws Exception {
return getAccountingPersistence().isConnectionActive(); return getPersistenceBackend().isConnectionActive();
} }
} }

View File

@ -41,6 +41,7 @@ public class AccountingPersistenceFactory {
AccountingPersistence accountingPersistence = persistences.get(context); AccountingPersistence accountingPersistence = persistences.get(context);
if(accountingPersistence==null){ if(accountingPersistence==null){
accountingPersistence = new AccountingPersistence(context); accountingPersistence = new AccountingPersistence(context);
persistences.put(context, accountingPersistence);
} }
return accountingPersistence; return accountingPersistence;
} }