public class SerializationPagedCache.PagedBinaryStore extends Base implements BinaryStore
Base.LoggingWriter, Base.StackFrame
BinaryStore.KeySetAware, BinaryStore.SizeAware
Constructor and Description |
---|
PagedBinaryStore(int cPages)
Construct a PagedBinaryStore.
|
Modifier and Type | Method and Description |
---|---|
protected SerializationPagedCache.WrapperBinaryStore |
advanceCurrentPage(SerializationPagedCache.WrapperBinaryStore store)
Advance the current page, using the passed BinaryStore as the store
for the new current page, and returning the oldest active page, if
the maximum number of active pages is exceeded by the advancing of
the current page.
|
void |
close()
Release underlying resources.
|
void |
erase(Binary binKey)
Remove the specified key from the underlying store if present.
|
void |
eraseAll()
Remove all data from the underlying store.
|
SerializationPagedCache.WrapperBinaryStore[] |
getActivePageArray()
Get the array of BinaryStore objects, one for each active page.
|
int |
getActivePageCount()
Determine the number of pages that the PagedBinaryStore is
currently managing.
|
protected SerializationPagedCache.WrapperBinaryStore |
getCurrentPage()
Obtain the page to which current updates are being performed.
|
int |
getCurrentPageNumber()
Determine the number of pages that the PagedBinaryStore has
managed in total, including those it is currently managing.
|
int |
getMaximumPages()
Determine the maximum number of pages that the cache will manage,
beyond which the oldest pages are destroyed.
|
protected SerializationPagedCache.WrapperBinaryStore |
getOldestActivePage()
Obtain the oldest active page.
|
SerializationPagedCache.WrapperBinaryStore |
getPage(int nPage)
Get the BinaryStore for the page specified by the passed page
number.
|
protected Map |
getPagedKeyMap()
Obtain the map that manages the mapping from Binary keys to
BinaryStore objects.
|
int |
getTotalPageCount()
Determine the number of pages that the PagedBinaryStore has
managed in total, including those it is currently managing.
|
boolean |
isPageActive(int nPage)
Determine if the specified page number is active.
|
Iterator |
keys()
Iterate all keys in the underlying store.
|
Binary |
load(Binary binKey)
Return the value associated with the specified key, or null if the
key does not have an associated value in the underlying store.
|
protected void |
logException(Throwable e,
String sMethod)
Helper to log ignored exceptions.
|
void |
store(Binary binKey,
Binary binValue)
Store the specified value under the specific key in the underlying
store.
|
protected int |
toPageIndex(int nPage)
Translate a page number to an index into the PageArray.
|
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
public PagedBinaryStore(int cPages)
cPages
- the maximum number of pages to have active at a
timepublic Binary load(Binary binKey)
load
in interface BinaryStore
binKey
- key whose associated value is to be returnedpublic void store(Binary binKey, Binary binValue)
store
in interface BinaryStore
binKey
- key to store the value underbinValue
- value to be storedpublic void erase(Binary binKey)
erase
in interface BinaryStore
binKey
- key whose mapping is to be removed from the mappublic void eraseAll()
eraseAll
in interface BinaryStore
public Iterator keys()
keys
in interface BinaryStore
public void close()
public int getMaximumPages()
public int getActivePageCount()
public int getTotalPageCount()
public int getCurrentPageNumber()
public boolean isPageActive(int nPage)
nPage
- the page number to testpublic SerializationPagedCache.WrapperBinaryStore[] getActivePageArray()
public SerializationPagedCache.WrapperBinaryStore getPage(int nPage)
nPage
- the page numberprotected SerializationPagedCache.WrapperBinaryStore getCurrentPage()
protected SerializationPagedCache.WrapperBinaryStore getOldestActivePage()
protected int toPageIndex(int nPage)
nPage
- the page numberprotected Map getPagedKeyMap()
protected SerializationPagedCache.WrapperBinaryStore advanceCurrentPage(SerializationPagedCache.WrapperBinaryStore store)
store
- the BinaryStore to use for the new current page