public abstract class ReadWriteBackingMap.StoreWrapper extends Base
Base.LoggingWriter, Base.StackFrame
Modifier and Type | Field and Description |
---|---|
protected long |
m_cEraseFailures
The number of Erase failures.
|
protected long |
m_cEraseMillis
The cumulative time spent on Erase operations.
|
protected long |
m_cEraseOps
The number of Erase operations.
|
protected long |
m_cLoadFailures
The number of Load failures.
|
protected long |
m_cLoadMillis
The cumulative time spent on Load operations.
|
protected long |
m_cLoadOps
The number of Load operations.
|
protected long |
m_cStoreEntries
The total number of entries written in Store operations.
|
protected long |
m_cStoreFailures
The number of Store failures.
|
protected long |
m_cStoreMillis
The cumulative time spent on Store operations.
|
protected long |
m_cStoreOps
The number of Store operations.
|
protected AbstractBundler |
m_eraseBundler
The bundler for erase() operations.
|
protected boolean |
m_fEraseAllSupported
Flag that determines whether or not EraseAll operations are supported
by the wrapped store.
|
protected boolean |
m_fEraseSupported
Flag that determines whether or not Erase operations are supported by
the wrapped store.
|
protected boolean |
m_fStoreAllSupported
Flag that determines whether or not StoreAll operations are supported
by the wrapped store.
|
protected boolean |
m_fStoreSupported
Flag that determines whether or not Store operations are supported by
the wrapped store.
|
protected AbstractBundler |
m_loadBundler
The bundler for load() operations.
|
protected AbstractBundler |
m_storeBundler
The bundler for store() operations.
|
Constructor and Description |
---|
StoreWrapper() |
Modifier and Type | Method and Description |
---|---|
protected long |
calculateRequeueDelay(ReadWriteBackingMap.WriteQueue queue)
Calculate the requeue delay after a store operation failed.
|
AbstractBundler |
ensureEraseBundler(int cBundleThreshold)
Configure the bundler for the "erase" operations.
|
AbstractBundler |
ensureLoadBundler(int cBundleThreshold)
Configure the bundler for the "load" operations.
|
AbstractBundler |
ensureStoreBundler(int cBundleThreshold)
Configure the bundler for the "store" operations.
|
protected void |
erase(ReadWriteBackingMap.Entry binEntry)
Remove the specified entry from the underlying store.
|
protected void |
eraseAll(Set setBinEntries)
Remove the specified entries from the underlying store.
|
protected abstract void |
eraseAllInternal(Set setBinEntries)
Remove the specified entries from the underlying store.
|
protected abstract void |
eraseInternal(ReadWriteBackingMap.Entry binEntry)
Remove the specified entry from the underlying store.
|
protected String |
formatKeys(Set setBinEntries,
String sHeader)
Generate a log message containing the keys from the specified set
of entries.
|
long |
getAverageBatchSize()
Determine the average number of entries stored per store() operation.
|
long |
getAverageEraseMillis()
Determine the average time spent per erase() operation.
|
long |
getAverageLoadMillis()
Determine the average time spent per load() operation.
|
long |
getAverageStoreMillis()
Determine the average time spent per store() operation.
|
AbstractBundler |
getEraseBundler()
Obtain the bundler for the "erase" operations.
|
long |
getEraseFailures()
Determine the number of erase() failures.
|
long |
getEraseMillis()
Determine the cumulative time spent on erase() operations.
|
long |
getEraseOps()
Determine the number of erase() operations.
|
AbstractBundler |
getLoadBundler()
Obtain the bundler for the "load" operations.
|
long |
getLoadFailures()
Determine the number of load() failures.
|
long |
getLoadMillis()
Determine the cumulative time spent on load() operations.
|
long |
getLoadOps()
Determine the number of load() operations.
|
abstract Object |
getStore()
Return the cache store object to which this wrapper delegates.
|
AbstractBundler |
getStoreBundler()
Obtain the bundler for the "store" operations.
|
long |
getStoreFailures()
Determine the number of store() failures.
|
long |
getStoreMillis()
Determine the cumulative time spent on store() operations.
|
long |
getStoreOps()
Determine the number of store() operations.
|
protected abstract AbstractBundler |
instantiateEraseBundler()
Create the bundler for the erase operations.
|
protected abstract AbstractBundler |
instantiateLoadBundler()
Create the bundler for the load operations.
|
protected abstract AbstractBundler |
instantiateStoreBundler()
Create the bundler for the store operations.
|
boolean |
isEraseAllSupported()
Determine if the wrapped store supports eraseAll() operations.
|
boolean |
isEraseSupported()
Determine if the wrapped store supports erase() operations.
|
boolean |
isStoreAllSupported()
Determine if the wrapped store supports storeAll() operations.
|
boolean |
isStoreSupported()
Determine if the wrapped store supports store() operations.
|
protected ReadWriteBackingMap.Entry |
load(Object binKey)
Return the entry associated with the specified key, or null if the
key does not have an associated value in the underlying store.
|
protected Set |
loadAll(Set setBinKey)
Return the entry set associated with the specified keys in the
passed collection.
|
protected abstract Set |
loadAllInternal(Set setBinKey)
Load the entries associated with each of the specified binary keys
from the underlying store.
|
protected abstract ReadWriteBackingMap.Entry |
loadInternal(Object binKey)
Load the entry associated with the specified key from the underlying
store.
|
protected void |
onEraseAllFailure(Set setBinEntries,
Exception e)
Logs a store eraseAll() failure.
|
protected void |
onEraseFailure(Object oKeyReal,
Exception e)
Logs a store erase() failure.
|
protected void |
onLoadAllFailure(Collection colKeys,
Exception e)
Logs a store loadAll() failure.
|
protected void |
onLoadFailure(Object oKeyReal,
Exception e)
Logs a store load() failure.
|
protected void |
onStoreAllFailure(Set setBinEntries,
Exception e)
Logs a store storeAll() failure.
|
protected void |
onStoreFailure(ReadWriteBackingMap.Entry entry,
Exception e)
Logs a store store() failure.
|
protected void |
replace(ReadWriteBackingMap.Entry entry)
Replace the value in the internal cache for the specified entry.
|
protected void |
reportUnsupported(String sOp)
Log the info about an unsupported operation.
|
protected boolean |
requeue(ReadWriteBackingMap.WriteQueue queue,
int cThreshold,
ReadWriteBackingMap.Entry entry)
Requeue the specified entry.
|
void |
resetStatistics()
Reset the CacheStore statistics.
|
void |
setEraseAllSupported(boolean fSupported)
Set the flag that determines whether or not the wrapped store
supports eraseAll() operations.
|
void |
setEraseSupported(boolean fSupported)
Set the flag that determines whether or not the wrapped store
supports erase() operations.
|
void |
setStoreAllSupported(boolean fSupported)
Set the flag that determines whether or not the wrapped store
supports storeAll() operations.
|
void |
setStoreSupported(boolean fSupported)
Set the flag that determines whether or not the wrapped store
supports store() operations.
|
protected void |
store(ReadWriteBackingMap.Entry binEntry,
boolean fAllowChange)
Store the specified entry in the underlying store.
|
protected void |
storeAll(Set setBinEntries)
Store the entries in the specified set in the underlying store.
|
protected abstract void |
storeAllInternal(Set setBinEntries)
Store the entries in the specified set in the underlying store.
|
protected abstract void |
storeInternal(ReadWriteBackingMap.Entry binEntry)
Store the specified entry in the underlying store.
|
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, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, 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
protected volatile long m_cLoadOps
protected volatile long m_cLoadFailures
protected volatile long m_cLoadMillis
protected volatile long m_cStoreOps
protected volatile long m_cStoreEntries
protected volatile long m_cStoreFailures
protected volatile long m_cStoreMillis
protected volatile long m_cEraseOps
protected volatile long m_cEraseFailures
protected volatile long m_cEraseMillis
protected boolean m_fStoreSupported
protected boolean m_fStoreAllSupported
protected boolean m_fEraseSupported
protected boolean m_fEraseAllSupported
protected AbstractBundler m_loadBundler
protected AbstractBundler m_storeBundler
protected AbstractBundler m_eraseBundler
public AbstractBundler ensureLoadBundler(int cBundleThreshold)
cBundleThreshold
- the bundle size threshold; pass zero to
disable "load" operation bundlingpublic AbstractBundler ensureStoreBundler(int cBundleThreshold)
cBundleThreshold
- the bundle size threshold; pass zero to
disable "store" operation bundlingpublic AbstractBundler ensureEraseBundler(int cBundleThreshold)
cBundleThreshold
- the bundle size threshold; pass zero to
disable "erase" operation bundlingpublic long getLoadOps()
public long getLoadFailures()
public long getLoadMillis()
public long getStoreOps()
public long getStoreFailures()
public long getStoreMillis()
public long getEraseOps()
public long getEraseFailures()
public long getEraseMillis()
public long getAverageBatchSize()
public long getAverageLoadMillis()
public long getAverageStoreMillis()
public long getAverageEraseMillis()
public void resetStatistics()
public AbstractBundler getLoadBundler()
public AbstractBundler getStoreBundler()
public AbstractBundler getEraseBundler()
public boolean isStoreSupported()
public void setStoreSupported(boolean fSupported)
fSupported
- the new value of the flagpublic boolean isStoreAllSupported()
public void setStoreAllSupported(boolean fSupported)
fSupported
- the new value of the flagpublic boolean isEraseSupported()
public void setEraseSupported(boolean fSupported)
fSupported
- the new value of the flagpublic boolean isEraseAllSupported()
public void setEraseAllSupported(boolean fSupported)
fSupported
- the new value of the flagprotected ReadWriteBackingMap.Entry load(Object binKey)
Same as CacheLoader.load(K)
, but the key and the value
are in the internal format.
binKey
- binary key whose associated entry is to be returnedprotected Set loadAll(Set setBinKey)
Same as CacheLoader.loadAll(java.util.Collection<? extends K>)
, but the keys are in the
internal format.
setBinKey
- a set of keys to loadprotected void store(ReadWriteBackingMap.Entry binEntry, boolean fAllowChange)
binEntry
- the entryfAllowChange
- if true, any changes made to the entry by the
store operation should be applied to the
internal cache; otherwise they will be
dealt with by the callerprotected void storeAll(Set setBinEntries)
setBinEntries
- the set of binary entriesprotected void erase(ReadWriteBackingMap.Entry binEntry)
binEntry
- the entryprotected void eraseAll(Set setBinEntries)
setBinEntries
- the set of entriesprotected void replace(ReadWriteBackingMap.Entry entry)
For write-behind, we should replace (and undecorate) the value *only* if the internal cache still holds the value it contained when the entry was de-queued for store operations.
Note: for write-through RWBM, this method is only called while the entry is locked
entry
- the entry that holds the binary value to replaceprotected void onLoadFailure(Object oKeyReal, Exception e)
oKeyReal
- the keye
- the exceptionprotected void onLoadAllFailure(Collection colKeys, Exception e)
colKeys
- colKeys a collection of keys in external form to loade
- the exceptionprotected void onStoreFailure(ReadWriteBackingMap.Entry entry, Exception e)
entry
- the entrye
- the exceptionprotected void onStoreAllFailure(Set setBinEntries, Exception e)
setBinEntries
- set of Entries
e
- the exceptionprotected boolean requeue(ReadWriteBackingMap.WriteQueue queue, int cThreshold, ReadWriteBackingMap.Entry entry)
Note: Subclasses could override this method and perform some type of the "last recovery attempt" operation if the super.requeue(...) call returns false. Note 2: Starting with Coherence 3.6 a positive threshold value ensures that entries are never dropped. The signature of the method did not change to maintain backward compatibility.
queue
- the queue (never null)cThreshold
- the queue size thresholdentry
- the entry to requeueprotected long calculateRequeueDelay(ReadWriteBackingMap.WriteQueue queue)
queue
- the write-behind queueprotected void onEraseFailure(Object oKeyReal, Exception e)
oKeyReal
- the keye
- the exceptionprotected void onEraseAllFailure(Set setBinEntries, Exception e)
setBinEntries
- set of Entries
e
- the exceptionprotected void reportUnsupported(String sOp)
sOp
- the unsupported operationprotected String formatKeys(Set setBinEntries, String sHeader)
setBinEntries
- set of Entries
sHeader
- message headerpublic abstract Object getStore()
protected abstract AbstractBundler instantiateLoadBundler()
protected abstract AbstractBundler instantiateStoreBundler()
protected abstract AbstractBundler instantiateEraseBundler()
protected abstract ReadWriteBackingMap.Entry loadInternal(Object binKey)
binKey
- binary key whose associated value is to be loadedprotected abstract Set loadAllInternal(Set setBinKey)
setBinKey
- a set of binary keys to loadprotected abstract void storeInternal(ReadWriteBackingMap.Entry binEntry)
binEntry
- the entry to be storedprotected abstract void storeAllInternal(Set setBinEntries)
setBinEntries
- the set of entries to be storedprotected abstract void eraseInternal(ReadWriteBackingMap.Entry binEntry)
binEntry
- the entry to be removed from the storeprotected abstract void eraseAllInternal(Set setBinEntries)
setBinEntries
- the set entries to be removed from the store