diff --git a/src/main/java/org/gcube/documentstore/persistence/FallbackPersistenceBackend.java b/src/main/java/org/gcube/documentstore/persistence/FallbackPersistenceBackend.java index 954f3ed..d0ddaee 100644 --- a/src/main/java/org/gcube/documentstore/persistence/FallbackPersistenceBackend.java +++ b/src/main/java/org/gcube/documentstore/persistence/FallbackPersistenceBackend.java @@ -43,7 +43,16 @@ public class FallbackPersistenceBackend extends PersistenceBackend { // Nothing TO DO } + /** + * {@inheritDoc} + */ + @Override + public void close() throws Exception { + // Nothing TO DO + } + + /** * {@inheritDoc} * This method is synchronized on {@link File} used, so any actions which @@ -69,20 +78,7 @@ public class FallbackPersistenceBackend extends PersistenceBackend { } } - /** - * {@inheritDoc} - */ - @Override - public void close() throws Exception { - // Nothing TO DO - } - - @Override - protected void disconnect() throws Exception { - // TODO Auto-generated method stub - - } - + } diff --git a/src/main/java/org/gcube/documentstore/persistence/PersistenceBackend.java b/src/main/java/org/gcube/documentstore/persistence/PersistenceBackend.java index b71bb41..b69bcd7 100644 --- a/src/main/java/org/gcube/documentstore/persistence/PersistenceBackend.java +++ b/src/main/java/org/gcube/documentstore/persistence/PersistenceBackend.java @@ -82,7 +82,7 @@ public abstract class PersistenceBackend { /** * Prepare the connection to persistence. - * This method must be used by implementation class to open + * This method must be used by implementation class to prepare * the connection with the persistence storage, DB, file etc. * @param configuration The configuration to create the connection * @throws Exception if fails @@ -90,22 +90,25 @@ public abstract class PersistenceBackend { protected abstract void prepareConnection(PersistenceBackendConfiguration configuration) throws Exception; /** - * This method is for open db connection + * This method is used to open db connection * @throws Exception */ protected abstract void openConnection() throws Exception ; /** - * This method is for close db connection + * This method is used to close db connection * @throws Exception */ protected abstract void close() throws Exception; /** - * This method is for close db and disconnect from cluster + * This method is used to close db and clean the configuration. + * It is used when there are too much TimeoutException trying to persist + * records. * @throws Exception */ - protected abstract void disconnect() throws Exception ; + protected void closeAndClean() throws Exception {} + ; /** * This method contains the code to save the {@link Record} @@ -158,7 +161,7 @@ public abstract class PersistenceBackend { //PersistenceBackendFactory.renew(this); countFallback=0; //disconnect - this.disconnect(); + this.closeAndClean(); } } else{