Package com.tangosol.persistence
Class AbstractPersistenceManager.AbstractPersistentStore.BatchTask
- java.lang.Object
-
- com.tangosol.util.Base
-
- 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.Task implements KeyAssociation
Runnable implementation that is used to perform and commit a sequence of mutating persistent store operations asynchronously.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractPersistenceManager.AbstractPersistentStore.BatchTask.EraseOperation
An erase() Operation.protected class
AbstractPersistenceManager.AbstractPersistentStore.BatchTask.Operation
Base class for Runnable implementations that encapsulate a persistent store operation.protected class
AbstractPersistenceManager.AbstractPersistentStore.BatchTask.StoreOperation
A store() Operation.-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected Collector<Object>
f_collector
An optional Collector to add notifications to.protected List<AbstractPersistenceManager.AbstractPersistentStore.BatchTask.Operation>
f_listOps
The sequence of operations to commit atomically.protected Object
f_oReceipt
The receipt to add to the Collector after the unit is committed.protected Object
f_oToken
A token representing the atomic unit that will be committed asynchronously.-
Fields inherited from class com.tangosol.persistence.AbstractPersistenceManager.Task
f_canceled
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort(Throwable eCause)
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.Object
getAssociatedKey()
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 Detail
-
f_oToken
protected final Object f_oToken
A token representing the atomic unit that will be committed asynchronously.
-
f_collector
protected final Collector<Object> f_collector
An optional Collector to add notifications to.
-
f_oReceipt
protected final Object f_oReceipt
The receipt to add to the Collector after the unit is committed.
-
f_listOps
protected final List<AbstractPersistenceManager.AbstractPersistentStore.BatchTask.Operation> f_listOps
The sequence of operations to commit atomically.
-
-
Constructor Detail
-
BatchTask
public BatchTask(Object oToken, Collector<Object> collector, Object oReceipt)
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 Detail
-
store
public void store(long lExtentId, ReadBuffer bufKey, ReadBuffer bufValue)
Queue a store operation.- Parameters:
lExtentId
- the extent identifier for the keybufKey
- key to store the value underbufValue
- value to be stored
-
erase
public void erase(long lExtentId, ReadBuffer bufKey)
Queue an erase operation.- Parameters:
lExtentId
- the extent identifier for the keybufKey
- 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 classAbstractPersistenceManager.Task
-
notifyCanceled
public void notifyCanceled(Throwable eCause)
Notify the task that it has been canceled.- Overrides:
notifyCanceled
in classAbstractPersistenceManager.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 interfaceAssociated
- 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 addfFlush
- if true, the collector will be flushed after adding the item
-
-