Class AbstractPersistenceManager.AbstractPersistentStore.BatchTask

java.lang.Object
com.tangosol.util.Base
AbstractPersistenceManager<PS>.com.tangosol.persistence.AbstractPersistenceManager.Task
com.tangosol.persistence.AbstractPersistenceManager.AbstractPersistentStore.BatchTask
All Implemented Interfaces:
Associated, KeyAssociation, Runnable
Enclosing class:
AbstractPersistenceManager.AbstractPersistentStore

protected class AbstractPersistenceManager.AbstractPersistentStore.BatchTask extends AbstractPersistenceManager<PS>.Task implements KeyAssociation
Runnable implementation that is used to perform and commit a sequence of mutating persistent store operations asynchronously.
  • Field Details

  • Constructor Details

    • BatchTask

      public BatchTask(Object oToken, Collector<Object> collector, Object oReceipt)
      Create a new BatchTask.
      Parameters:
      oToken - a token that represents the atomic unit to commit
      collector - an optional Collector to notify
      oReceipt - the receipt to add to the Collector after the unit is committed
  • Method Details

    • store

      public void store(long lExtentId, ReadBuffer bufKey, ReadBuffer bufValue)
      Queue a store operation.
      Parameters:
      lExtentId - the extent identifier for the key
      bufKey - key to store the value under
      bufValue - value to be stored
    • erase

      public void erase(long lExtentId, ReadBuffer bufKey)
      Queue an erase operation.
      Parameters:
      lExtentId - the extent identifier for the key
      bufKey - key whose mapping is to be removed
    • abort

      public void abort(Throwable eCause)
      Abort all changes that have been made to the persistent store by this BatchTask.
      Parameters:
      eCause - optional cause for the abort
    • execute

      public void execute()
      Execute all queued operations and commit changes.
      Specified by:
      execute in class AbstractPersistenceManager<PS extends AbstractPersistenceManager.AbstractPersistentStore>.Task
    • notifyCanceled

      public void notifyCanceled(Throwable eCause)
      Notify the task that it has been canceled.
      Overrides:
      notifyCanceled in class AbstractPersistenceManager<PS extends AbstractPersistenceManager.AbstractPersistentStore>.Task
      Parameters:
      eCause - the optional cause of the cancellation
    • getAssociatedKey

      public Object getAssociatedKey()
      Determine the host key (or base) object to which this object is associated.

      Note: It's expected that the returned object is suitable to be used as an immutable identity (e.g. a key in a Map).
      Note 2: Circular associations are not permitted.

      Specified by:
      getAssociatedKey in interface Associated
      Returns:
      the host key that for this object, or null if this object has no association
    • notifyCollector

      protected void notifyCollector(Object oItem, boolean fFlush)
      Add the given object to the configured collector (if any). If the add operation throws an exception, it will be caught and logged.
      Parameters:
      oItem - the item to add
      fFlush - if true, the collector will be flushed after adding the item