Package com.tangosol.io.journal
Class JournalBinaryStore
java.lang.Object
com.tangosol.io.journal.JournalBinaryStore
- All Implemented Interfaces:
Disposable,BinaryStore,BinaryStore.KeySetAware,BinaryStore.SizeAware,Journal.JournalConsumer,AutoCloseable
public class JournalBinaryStore
extends Object
implements BinaryStore.KeySetAware, Journal.JournalConsumer
A BinaryStore that writes to a Journal.
- Since:
- Coherence 3.7
- Author:
- cp 2010-06-10; rhl 2013-01-18
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classThe ClearListener is used to ensure that entries are removed from the journal when the corresponding keys areclearedfrom the ticket tree.Nested classes/interfaces inherited from interface com.tangosol.io.BinaryStore
BinaryStore.KeySetAware, BinaryStore.SizeAware -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LockThe lock that should be used to control concurrent access to this Journal Binary Store.protected final MultiBinaryLongMapThe MultiBinaryLongMap.protected BinaryLongMapMapping from Binary keys to journal "tickets".protected final AtomicLongNumber of bytes in the Journal currently "owned" by this BinaryStore.protected longThe number of evacuations occurred on thisJournal.JournalConsumer.protected JournalThe journal manager for this BinaryStore. -
Constructor Summary
ConstructorsConstructorDescriptionJournalBinaryStore(Journal journal) Construct a JournalBinaryStore.JournalBinaryStore(Journal journal, MultiBinaryLongMap mblm) Construct a JournalBinaryStore. -
Method Summary
Modifier and TypeMethodDescriptionprotected BinaryLongMapConfigure and return the BinaryLongMap to be used to store journal tickets.booleancontainsKey(Binary binKey) Return true iff this BinaryStore contains a mapping for the specified key.voiddedupe(byte[][] aab) This method may be invoked by the Journal implementation to request that any immutable byte arrays managed by the consumer be de-duplicated.voiddispose()Invoked when all resources owned by the implementer can safely be released.voidRemove the specified key from the underlying store if present.voideraseAll()Remove all data from the underlying store.voidevacuate(long lTicketMask, long lTicketValue) This method may be invoked by the Journal implementation to request that the consumer evacuate a particular journal file.longCalculate the total amount of data currently stored in the journal by this BinaryStore.Format a String description of the Consumer.Obtain the underlying journaling system used by this BinaryStore.intDetermine the number of keys currently stored in the journal by this BinaryStore.Return theMultiBinaryLongMapused to store the underlying keys in this KeySetAware BinaryStore.protected BinaryLongMapAn internal accessor for the "tree of tickets"; this accessor is used only by client threads, and has a built-in check for if the journal has already been disposed of (which could occur on a different thread).keys()Iterate all keys in the underlying store.Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.intsize()Determine the number of keys in the BinaryStore.voidStore the specified value under the specific key in the underlying store.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oracle.coherence.common.base.Disposable
close
-
Field Details
-
m_cEvacuations
protected volatile long m_cEvacuationsThe number of evacuations occurred on thisJournal.JournalConsumer. -
m_journal
The journal manager for this BinaryStore. -
m_blmTickets
Mapping from Binary keys to journal "tickets". -
f_mblm
The MultiBinaryLongMap. -
m_cbTotal
Number of bytes in the Journal currently "owned" by this BinaryStore. -
f_journalBinaryStoreLock
The lock that should be used to control concurrent access to this Journal Binary Store.
-
-
Constructor Details
-
JournalBinaryStore
Construct a JournalBinaryStore.- Parameters:
journal- the Journal to write to and read from
-
JournalBinaryStore
Construct a JournalBinaryStore.- Parameters:
journal- the Journal to write to and read frommblm- the MultiBinaryLongMap used to store the keys and tickets
-
-
Method Details
-
load
Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.- Specified by:
loadin interfaceBinaryStore- Parameters:
binKey- key whose associated value is to be returned- Returns:
- the value associated with the specified key, or null if no value is available for that key
-
store
Store the specified value under the specific key in the underlying store. This method is intended to support both key/value creation and value update for a specific key.- Specified by:
storein interfaceBinaryStore- Parameters:
binKey- key to store the value underbinValue- value to be stored
-
erase
Remove the specified key from the underlying store if present.- Specified by:
erasein interfaceBinaryStore- Parameters:
binKey- key whose mapping is to be removed from the map
-
eraseAll
public void eraseAll()Remove all data from the underlying store.- Specified by:
eraseAllin interfaceBinaryStore
-
keys
Iterate all keys in the underlying store.- Specified by:
keysin interfaceBinaryStore- Returns:
- a read-only iterator of the keys in the underlying store
-
size
public int size()Determine the number of keys in the BinaryStore.- Specified by:
sizein interfaceBinaryStore.SizeAware- Returns:
- the number of keys in the BinaryStore
-
containsKey
Return true iff this BinaryStore contains a mapping for the specified key.- Specified by:
containsKeyin interfaceBinaryStore.KeySetAware- Parameters:
binKey- key whose presence in the BinaryStore is to be tested- Returns:
- true iff this BinaryStore contains a mapping for the specified key
-
getMultiBinaryLongMap
Return theMultiBinaryLongMapused to store the underlying keys in this KeySetAware BinaryStore.- Specified by:
getMultiBinaryLongMapin interfaceBinaryStore.KeySetAware- Returns:
- the MultiBinaryLongMap used to store the keys in this BinaryStore
-
evacuate
public void evacuate(long lTicketMask, long lTicketValue) This method may be invoked by the Journal implementation to request that the consumer evacuate a particular journal file.- Specified by:
evacuatein interfaceJournal.JournalConsumer- Parameters:
lTicketMask- indicates which bits of the tickets to checklTicketValue- indicates what bit pattern needs to be matched on the tickets in order to select them for evacuation
-
dedupe
public void dedupe(byte[][] aab) This method may be invoked by the Journal implementation to request that any immutable byte arrays managed by the consumer be de-duplicated.- Specified by:
dedupein interfaceJournal.JournalConsumer- Parameters:
aab- an array of byte[] objects for intern-ing byte[] references
-
getDescription
Format a String description of the Consumer.- Specified by:
getDescriptionin interfaceJournal.JournalConsumer- Returns:
- a comma-delimited key-value description of this object
-
dispose
public void dispose()Invoked when all resources owned by the implementer can safely be released.Once disposed of the object should no longer be considered to be usable.
Note the Disposable interface is compatible with try-with-resources which will automatically invoke this method.
- Specified by:
disposein interfaceDisposable
-
toString
-
getJournal
Obtain the underlying journaling system used by this BinaryStore.- Returns:
- the Journal that this JournalBinaryStore uses.
-
getKeyCount
public int getKeyCount()Determine the number of keys currently stored in the journal by this BinaryStore. Note that this doesn't including data that has been released but whose space has not yet been reclaimed by the journal.- Returns:
- the number of keys in the journal held for this BinaryStore
-
getByteCount
public long getByteCount()Calculate the total amount of data currently stored in the journal by this BinaryStore. Note that this doesn't including data that has been released but whose space has not yet been reclaimed by the journal.- Returns:
- the number of bytes in the journal used by this BinaryStore
-
getTicketTree
An internal accessor for the "tree of tickets"; this accessor is used only by client threads, and has a built-in check for if the journal has already been disposed of (which could occur on a different thread).- Returns:
- the tree of tickets
-
configureTicketTree
Configure and return the BinaryLongMap to be used to store journal tickets.- Returns:
- the BinaryLongMap to be used to store journal tickets
-