Package com.tangosol.persistence
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
An erase() Operation.protected class
Base class for Runnable implementations that encapsulate a persistent store operation.protected class
A store() Operation.Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
Modifier and TypeFieldDescriptionAn optional Collector to add notifications to.protected final List
<AbstractPersistenceManager<PS>.AbstractPersistentStore.BatchTask.Operation> The sequence of operations to commit atomically.protected final Object
The receipt to add to the Collector after the unit is committed.protected final Object
A token representing the atomic unit that will be committed asynchronously.Fields inherited from class com.tangosol.persistence.AbstractPersistenceManager.Task
f_canceled
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Abort all changes that have been made to the persistent store by this BatchTask.void
erase
(long lExtentId, ReadBuffer bufKey) Queue an erase operation.void
execute()
Execute all queued operations and commit changes.Determine the host key (or base) object to which this object is associated.void
notifyCanceled
(Throwable eCause) Notify the task that it has been canceled.protected void
notifyCollector
(Object oItem, boolean fFlush) Add the given object to the configured collector (if any).void
store
(long lExtentId, ReadBuffer bufKey, ReadBuffer bufValue) Queue a store operation.Methods inherited from class com.tangosol.persistence.AbstractPersistenceManager.Task
cancel, register, run
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Field Details
-
f_oToken
A token representing the atomic unit that will be committed asynchronously. -
f_collector
An optional Collector to add notifications to. -
f_oReceipt
The receipt to add to the Collector after the unit is committed. -
f_listOps
protected final List<AbstractPersistenceManager<PS extends AbstractPersistenceManager.AbstractPersistentStore>.AbstractPersistentStore.BatchTask.Operation> f_listOpsThe sequence of operations to commit atomically.
-
-
Constructor Details
-
BatchTask
Create a new BatchTask.- Parameters:
oToken
- a token that represents the atomic unit to commitcollector
- an optional Collector to notifyoReceipt
- the receipt to add to the Collector after the unit is committed
-
-
Method Details
-
store
Queue a store operation.- Parameters:
lExtentId
- the extent identifier for the keybufKey
- key to store the value underbufValue
- value to be stored
-
erase
Queue an erase operation.- Parameters:
lExtentId
- the extent identifier for the keybufKey
- key whose mapping is to be removed
-
abort
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 classAbstractPersistenceManager<PS extends AbstractPersistenceManager.AbstractPersistentStore>.Task
-
notifyCanceled
Notify the task that it has been canceled.- Overrides:
notifyCanceled
in classAbstractPersistenceManager<PS extends AbstractPersistenceManager.AbstractPersistentStore>.Task
- Parameters:
eCause
- the optional cause of the cancellation
-
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 interfaceAssociated
- Returns:
- the host key that for this object, or null if this object has no association
-
notifyCollector
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 addfFlush
- if true, the collector will be flushed after adding the item
-