This commit is contained in:
Alessandro Pieve 2017-01-25 10:35:31 +00:00
parent eee48e69ca
commit 3ac3967ca9
2 changed files with 19 additions and 20 deletions

View File

@ -43,7 +43,16 @@ public class FallbackPersistenceBackend extends PersistenceBackend {
// Nothing TO DO // Nothing TO DO
} }
/**
* {@inheritDoc}
*/
@Override
public void close() throws Exception {
// Nothing TO DO
}
/** /**
* {@inheritDoc} * {@inheritDoc}
* This method is synchronized on {@link File} used, so any actions which * 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
}
} }

View File

@ -82,7 +82,7 @@ public abstract class PersistenceBackend {
/** /**
* Prepare the connection to persistence. * 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. * the connection with the persistence storage, DB, file etc.
* @param configuration The configuration to create the connection * @param configuration The configuration to create the connection
* @throws Exception if fails * @throws Exception if fails
@ -90,22 +90,25 @@ public abstract class PersistenceBackend {
protected abstract void prepareConnection(PersistenceBackendConfiguration configuration) throws Exception; 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 * @throws Exception
*/ */
protected abstract void openConnection() 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 * @throws Exception
*/ */
protected abstract void close() 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 * @throws Exception
*/ */
protected abstract void disconnect() throws Exception ; protected void closeAndClean() throws Exception {}
;
/** /**
* This method contains the code to save the {@link Record} * This method contains the code to save the {@link Record}
@ -158,7 +161,7 @@ public abstract class PersistenceBackend {
//PersistenceBackendFactory.renew(this); //PersistenceBackendFactory.renew(this);
countFallback=0; countFallback=0;
//disconnect //disconnect
this.disconnect(); this.closeAndClean();
} }
} }
else{ else{