Class FallbackPersistenceBackend
java.lang.Object
org.gcube.documentstore.persistence.PersistenceBackend
org.gcube.documentstore.persistence.FallbackPersistenceBackend
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
Fields inherited from class org.gcube.documentstore.persistence.PersistenceBackend
aggregationScheduler, fallbackPersistence, fallbackUseCounter, fallbackUseStartTime, forceFallbackUse, MAX_FALLBACK_RETRY, MAX_TIME_TO_FALLBACK, persistenceBackendMonitor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaccountWithFallback(Record... records) protected voidclean()This method is used to allow PersistenceBackend implementations to clean a global status if any (or to renew it) when to much exceptions occurs trying to persist Records.voidclose()This method is used to closeprotected voidThis method is used to close db connectionprotected Fileprotected FileDeprecated.booleanCheck the Connection stateprotected FilemoveFallbackFile(String suffix) Move the fallbackFile to a new file with the same name by appending a suffixprotected voidThis method is used to open db connectionvoidprepareConnection(PersistenceBackendConfiguration configuration) Prepare the connection to persistence.protected voidThis method is synchronized on fallbackFile.protected voidreallyAccount(Record record) This method contains the code to save theRecordMethods inherited from class org.gcube.documentstore.persistence.PersistenceBackend
account, accountValidateAggregate, flush, flush, getAggregationScheduler, getFallbackPersistence, setAggregationScheduler, setFallback
-
Constructor Details
-
FallbackPersistenceBackend
-
-
Method Details
-
getFallbackFile
- Returns:
- the fallbackFile
-
getOldFallbackFile
Deprecated. -
moveFallbackFile
Move the fallbackFile to a new file with the same name by appending a suffix- Parameters:
suffix-- Returns:
- the moved file if any, null otherwise
-
prepareConnection
Prepare the connection to persistence. This method must be used by implementation class to prepare the connection with the persistence storage, DB, file etc.- Specified by:
prepareConnectionin classPersistenceBackend- Parameters:
configuration- The configuration to create the connection
-
openConnection
Description copied from class:PersistenceBackendThis method is used to open db connection- Specified by:
openConnectionin classPersistenceBackend- Throws:
Exception
-
close
This method is used to close- Overrides:
closein classPersistenceBackend- Throws:
Exception
-
accountWithFallback
- Overrides:
accountWithFallbackin classPersistenceBackend- Throws:
Exception
-
reallyAccount
This method contains the code to save theRecord- Specified by:
reallyAccountin classPersistenceBackend
-
printLine
This method is synchronized on fallbackFile. Any actions which has to modify, rename or delete the file must be synchronized on this file. To retrieve it usegetFallbackFile()method. This is intended for internal library usage only so that is protected. It- Throws:
Exception
-
closeConnection
Description copied from class:PersistenceBackendThis method is used to close db connection- Specified by:
closeConnectionin classPersistenceBackend- Throws:
Exception
-
isConnectionActive
Description copied from class:PersistenceBackendCheck the Connection state- Specified by:
isConnectionActivein classPersistenceBackend- Returns:
- true if the connection is active, false otherwise
- Throws:
Exception
-
clean
Description copied from class:PersistenceBackendThis method is used to allow PersistenceBackend implementations to clean a global status if any (or to renew it) when to much exceptions occurs trying to persist Records.- Specified by:
cleanin classPersistenceBackend- Throws:
Exception
-