Class MongoArchiveOperationHandler
java.lang.Object
com.gigaspaces.persistency.archive.MongoArchiveOperationHandler
- All Implemented Interfaces:
ArchiveOperationHandler
- Author:
- Shadi Massalha
-
Constructor Summary
ConstructorsConstructorDescriptionMongoArchiveOperationHandler(GigaSpace gigaSpace, String db, com.mongodb.MongoClient client) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidWrites the specified objects to the external storagevoiddestroy()com.mongodb.MongoClientvoidsetConfig(com.mongodb.MongoClient client) voidvoidsetGigaSpace(GigaSpace gigaSpace) booleanWhat happens when the archive operation receives a batch of objects to persist and throws an exception in the middle of the archiving? The external archive container (assuming the exception is not swollen with an exception handler) will retry archiving all objects.
-
Constructor Details
-
MongoArchiveOperationHandler
-
-
Method Details
-
setGigaSpace
-
archive
Description copied from interface:ArchiveOperationHandlerWrites the specified objects to the external storage- Specified by:
archivein interfaceArchiveOperationHandler- Parameters:
objects- - one or more objects to write. If notArchiveOperationHandler.supportsBatchArchiving()then only one object is passed at a time.- Throws:
SpaceMongoException- - Problem encountered while archiving to mongodb- See Also:
-
supportsBatchArchiving
public boolean supportsBatchArchiving()Description copied from interface:ArchiveOperationHandlerWhat happens when the archive operation receives a batch of objects to persist and throws an exception in the middle of the archiving? The external archive container (assuming the exception is not swollen with an exception handler) will retry archiving all objects. If the archive operation implementation is atomic (meaning that throwing an exception cancels all writes - all or nothing) then return true. If the archive operation implementation is idempotent (meaning that writing the same objects twice has no visibility on the result) then return true. Otherwise return false, so the archive method is called one object at a time. Even when returning false, there is a possibility of an object being archived twice in case of a process fail-over.- Specified by:
supportsBatchArchivingin interfaceArchiveOperationHandler- Returns:
- true - Since Multiple archiving of the exact same objects is supported (idempotent).
- See Also:
-
afterPropertiesSet
@PostConstruct public void afterPropertiesSet() -
getGigaSpace
-
setDb
- Parameters:
db- Mongo database name.- See Also:
-
setConfig
public void setConfig(com.mongodb.MongoClient client) - Parameters:
client- Mongo database client.- See Also:
-
destroy
@PreDestroy public void destroy() -
getConfig
public com.mongodb.MongoClient getConfig()
-