|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.MultiBinaryLongMap.WrapperBinaryLongMap
com.tangosol.util.MultiBinaryLongMap.PrimaryBinaryLongMap
public class MultiBinaryLongMap.PrimaryBinaryLongMap
A BinaryLongMap implementation that logically represents the "primary" BinaryLongMap of the containing MultiBinaryLongMap.
The implementation dynamically switches between a "compressed" form which uses the real key-tree to store the primary BLM's logical contents, and a "delegating" multi-form which uses the LongStorage to associate multiple long values (split over multiple delegating BinaryLongMap instances) with each key.
Note: the reference to the "wrapped" underlying BLM can change dynamically as the containing MultiBinaryLongMap grows or shrinks in size. The MultiBinaryLongMap.PrimaryBinaryLongMap.ValidatingLock
provides a memory-barrier for this field, which is not otherwise declared "volatile".
Nested Class Summary | |
---|---|
protected class |
MultiBinaryLongMap.PrimaryBinaryLongMap.CompressedPrimaryBinaryLongMap The CompressedPrimaryBinaryLongMap is a trivial "Safe" wrapper around the main key-tree, which associates keys to their single (primary) long value. |
protected class |
MultiBinaryLongMap.PrimaryBinaryLongMap.DelegatingPrimaryBinaryLongMap An extension to the DelegatingBinaryLongMap for the "primary" or "owning" BinaryLongMap that is responsible for adding and removing keys. |
protected class |
MultiBinaryLongMap.PrimaryBinaryLongMap.RetryException Marker Exception thrown to indicate that the underlying BinaryLongMap implementation has concurrently changed and the operation needs to be resubmitted by the PrimaryBinaryLongMap. |
protected class |
MultiBinaryLongMap.PrimaryBinaryLongMap.ValidatingLock ValidatingLock is a Lock implementation specialized for the PrimaryBinaryLongMap that validates after every lock acquisition that the underlying BinaryLongMap implementation did not change. |
Nested classes/interfaces inherited from class com.tangosol.util.MultiBinaryLongMap.WrapperBinaryLongMap |
---|
MultiBinaryLongMap.WrapperBinaryLongMap.WrapperIterator |
Nested classes/interfaces inherited from interface com.tangosol.util.BinaryLongMap |
---|
BinaryLongMap.Entry, BinaryLongMap.EntryVisitor, BinaryLongMap.SimpleMapImpl |
Field Summary | |
---|---|
protected Listeners |
f_listeners The listeners to notify of changes to the BinaryLongMap. |
protected MultiBinaryLongMap.PrimaryBinaryLongMap.CompressedPrimaryBinaryLongMap |
f_pblmCompressed The "compressed" PBLM implementation. |
protected BinaryLongMap |
f_pblmMulti The "full" or "multi-aware" PBLM implementation. |
protected java.util.concurrent.locks.ReentrantReadWriteLock |
f_rwLockMaster The "master" read-write lock for the MultiBinaryLongMap. |
Fields inherited from class com.tangosol.util.MultiBinaryLongMap.WrapperBinaryLongMap |
---|
m_blm |
Constructor Summary | |
---|---|
MultiBinaryLongMap.PrimaryBinaryLongMap() Construct a PrimaryBinaryLongMap. |
Method Summary | |
---|---|
void |
addListener(MultiBinaryLongMap.BinaryLongMapListener listener) Add the specified listener to the collection of listeners that this DelegatingPrimaryBinaryLongMap dispatches notifications to. |
void |
clear() Initialize the map to an empty state. |
protected void |
deflateRep() Deflate the underlying representation of the PrimaryBinaryLongMap to use the main key-tree to associate a single long value with each key (logically represented by this PrimaryBinaryLongMap). |
long |
get(Binary binKey) Find the specified key in the map and return the value associated with it. |
protected void |
inflateRep() Inflate the underlying representation of the PrimaryBinaryLongMap to use the LongStorage to support multiple delegating BinaryLongMap instances. |
void |
internKeys(java.lang.Object o) Internal opaque method: De-duplicate keys. |
void |
keyAdded(Binary binKey) A notification that the primary map has added a new Binary/long key/value mapping; this implicitly creates a new key/value mapping in each delegating map, with the value being 0L. |
void |
keyRemoving(Binary binKey) A notification that the primary map is removing a Binary/long key/value mapping; this implies that the existing key/value mapping for the same Binary key in each delegating map is also being removed. |
java.util.Iterator |
keys() Obtain an iterator of the keys stored in the map. |
java.util.Iterator |
keys(com.oracle.common.base.Predicate predicate) Obtain an iterator of the keys stored in the map whose corresponding Entry matches the passed Predicate<Entry> . |
void |
mapCleared() A notification that the primary map has been cleared; this implies that all of the existing key/value mappings in each delegating map have also been removed. |
void |
mapClearing() A notification that the primary map is about to be cleared; this implies that all of the existing key/value mappings in each delegating map are about to be removed, but that no per-mapping events will be generated in response to those removals. |
void |
put(Binary binKey, long lValue) Blindly store the passed value for the specified key, adding the key if it is not already in the map, or replacing the current value if the key is in the map. |
boolean |
putIfAbsent(Binary binKey, long lValue) Store the passed value for the specified key, only if the key does not currently exist in the map. |
void |
remove(Binary binKey) Blindly remove the specified Binary key from the map. |
boolean |
remove(Binary binKey, long lValue) Remove the specified Binary key from the map iff it exists in the map and is associated with the specified value. |
void |
removeListener(MultiBinaryLongMap.BinaryLongMapListener listener) Remove the specified listener from the collection of listeners that this DelegatingPrimaryBinaryLongMap dispatches notifications to. |
boolean |
replace(Binary binKey, long lValueOld, long lValueNew) Store the passed "new" value for the specified key, only if the current value associated with the specified key is the same as the specified "old" value. |
int |
size() Determine the size of the map. |
void |
visit(Binary binKey, BinaryLongMap.EntryVisitor visitor) Apply the specified visitor to the entry associated with the specified key, if the entry exists or may be added. |
void |
visitAll(BinaryLongMap.EntryVisitor visitor) Apply the specified visitor to all entries in the BinaryLongMap. |
Methods inherited from class com.tangosol.util.MultiBinaryLongMap.WrapperBinaryLongMap |
---|
getMap, setMap |
Field Detail |
---|
protected final java.util.concurrent.locks.ReentrantReadWriteLock f_rwLockMaster
protected final MultiBinaryLongMap.PrimaryBinaryLongMap.CompressedPrimaryBinaryLongMap f_pblmCompressed
protected final BinaryLongMap f_pblmMulti
protected final Listeners f_listeners
Constructor Detail |
---|
public MultiBinaryLongMap.PrimaryBinaryLongMap()
Method Detail |
---|
protected void inflateRep()
Note: it is the caller's responsibility to hold the master exclusive lock during this operation
protected void deflateRep()
Note: it is the caller's responsibility to hold the master exclusive lock during this operation
public void addListener(MultiBinaryLongMap.BinaryLongMapListener listener)
listener
- the listener to add to the collection of listeners that this DelegatingPrimaryBinaryLongMap dispatches notifications topublic void removeListener(MultiBinaryLongMap.BinaryLongMapListener listener)
listener
- the listener to remove from the collection of listeners that this DelegatingPrimaryBinaryLongMap dispatches notifications topublic long get(Binary binKey)
get
in interface BinaryLongMap
get
in class MultiBinaryLongMap.WrapperBinaryLongMap
binKey
- a Binary keypublic void put(Binary binKey, long lValue)
Note that associating the value zero with a key is analogous to removing the key.
put
in interface BinaryLongMap
put
in class MultiBinaryLongMap.WrapperBinaryLongMap
binKey
- the Binary key to add or updatelValue
- the value to associate with the keypublic boolean putIfAbsent(Binary binKey, long lValue)
Note that associating the value zero with a key using this method will have no effect, since were that key already present, there would be no change, and were it not present, the value zero is analogous to removing the key, which again is no change (since it is not present).
putIfAbsent
in interface BinaryLongMap
putIfAbsent
in class MultiBinaryLongMap.WrapperBinaryLongMap
binKey
- a Binary keylValue
- the new value to associate with the passed keypublic boolean replace(Binary binKey, long lValueOld, long lValueNew)
Note that replacing the value of zero is analogous to putIfAbsent
, and associating the value zero with a key using this method is the same as remove
passing the old value to match.
replace
in interface BinaryLongMap
replace
in class MultiBinaryLongMap.WrapperBinaryLongMap
binKey
- a Binary keylValueOld
- the assumed old value to replacelValueNew
- the new value to associate with the passed keypublic void remove(Binary binKey)
remove
in interface BinaryLongMap
remove
in class MultiBinaryLongMap.WrapperBinaryLongMap
binKey
- a Binary keypublic boolean remove(Binary binKey, long lValue)
Note that removing an association whose value is zero has no effect.
remove
in interface BinaryLongMap
remove
in class MultiBinaryLongMap.WrapperBinaryLongMap
binKey
- a Binary keylValue
- the value that the key must have in order to be removedpublic void clear()
clear
in interface BinaryLongMap
clear
in class MultiBinaryLongMap.WrapperBinaryLongMap
public int size()
size
in interface BinaryLongMap
size
in class MultiBinaryLongMap.WrapperBinaryLongMap
public java.util.Iterator keys()
keys
in interface BinaryLongMap
keys
in class MultiBinaryLongMap.WrapperBinaryLongMap
public java.util.Iterator keys(com.oracle.common.base.Predicate predicate)
Entry
matches the passed Predicate<Entry>
.
The entry passed to the predicate should be treated as read-only, and any attempt to modify the entry may have undefined behavior and/or throw an Exception. Modifications to entries should instead be performed using an BinaryLongMap.EntryVisitor
via the BinaryLongMap.visit(com.tangosol.util.Binary, com.tangosol.util.BinaryLongMap.EntryVisitor)
or BinaryLongMap.visitAll(com.tangosol.util.BinaryLongMap.EntryVisitor)
methods.
keys
in interface BinaryLongMap
keys
in class MultiBinaryLongMap.WrapperBinaryLongMap
predicate
- a Predicate<Entry> to apply to each Entrypublic void visit(Binary binKey, BinaryLongMap.EntryVisitor visitor)
BinaryLongMap.Entry.setValue(long)
).visit
in interface BinaryLongMap
visit
in class MultiBinaryLongMap.WrapperBinaryLongMap
binKey
- the key to visitvisitor
- the visitor to applypublic void visitAll(BinaryLongMap.EntryVisitor visitor)
visitAll
in interface BinaryLongMap
visitAll
in class MultiBinaryLongMap.WrapperBinaryLongMap
visitor
- the visitor to applypublic void internKeys(java.lang.Object o)
internKeys
in interface BinaryLongMap
internKeys
in class MultiBinaryLongMap.WrapperBinaryLongMap
o
- some implementation-specific objectpublic void keyAdded(Binary binKey)
keyAdded
in interface MultiBinaryLongMap.BinaryLongMapListener
binKey
- the key that was addedpublic void keyRemoving(Binary binKey)
keyRemoving
in interface MultiBinaryLongMap.BinaryLongMapListener
binKey
- the key that is being removedpublic void mapClearing()
mapClearing
in interface MultiBinaryLongMap.BinaryLongMapListener
public void mapCleared()
mapCleared
in interface MultiBinaryLongMap.BinaryLongMapListener
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |