Class MongoArchiveOperationHandler

java.lang.Object
com.gigaspaces.persistency.archive.MongoArchiveOperationHandler
All Implemented Interfaces:
ArchiveOperationHandler

public class MongoArchiveOperationHandler extends Object implements ArchiveOperationHandler
Author:
Shadi Massalha
  • Constructor Details

    • MongoArchiveOperationHandler

      public MongoArchiveOperationHandler(GigaSpace gigaSpace, String db, com.mongodb.MongoClient client)
  • Method Details

    • setGigaSpace

      public void setGigaSpace(GigaSpace gigaSpace)
    • archive

      public void archive(Object... objects)
      Description copied from interface: ArchiveOperationHandler
      Writes the specified objects to the external storage
      Specified by:
      archive in interface ArchiveOperationHandler
      Parameters:
      objects - - one or more objects to write. If not ArchiveOperationHandler.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: ArchiveOperationHandler
      What 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:
      supportsBatchArchiving in interface ArchiveOperationHandler
      Returns:
      true - Since Multiple archiving of the exact same objects is supported (idempotent).
      See Also:
    • afterPropertiesSet

      @PostConstruct public void afterPropertiesSet()
    • getGigaSpace

      public GigaSpace getGigaSpace()
    • setDb

      public void setDb(String db)
      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()