Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.util
Class MultiBinaryLongMap.MaskedLongMapHolder

java.lang.Object
  extended by com.tangosol.util.MultiBinaryLongMap.MaskedLongMapHolder

Direct Known Subclasses:
MultiBinaryLongMap.LeftoverLongMapHolder
Enclosing class:
MultiBinaryLongMap

protected static class MultiBinaryLongMap.MaskedLongMapHolder
extends java.lang.Object

MaskedLongMapHolder is used to produce MultiBinaryLongMap.MaskedBinaryLongMap instances backed by a shared BinaryLongMap. MaskedBinaryLongMap instances created by this holder are thread-safe and are all protected by the same shared and exclusive locks.


Field Summary
protected  BinaryLongMap f_blm
          The BinaryLongMap shared by the component masked BLMs.
protected  long f_lMaskReserved
          The bit-mask describing which bits in the underlying BLM representation are reserved (and may not be allocated by this holder).
protected  java.util.concurrent.locks.Lock f_lockS
          The shared lock used to protected the logical contents of the maps exposed by this MaskedLongMapHolder.
protected  java.util.concurrent.locks.Lock f_lockX
          The exclusive lock used to protected the logical contents of the maps exposed by this MaskedLongMapHolder.
protected  java.util.List m_listBLMs
          The list of reserved masked BLMs, ordered by increasing shift-position.
protected  long m_lMaskFree
          The bit-mask describing which bits in the underlying BLM representation are free.

 

Constructor Summary
MultiBinaryLongMap.MaskedLongMapHolder(BinaryLongMap blm, java.util.concurrent.locks.Lock lockSMaster)
          Construct a MaskedLongMapHolder backed by the specified blm.
MultiBinaryLongMap.MaskedLongMapHolder(BinaryLongMap blm, java.util.concurrent.locks.Lock lockSMaster, long lMaskReserved)
          Construct a MaskedLongMapHolder backed by the specified blm with the specified reserved bit-mask.

 

Method Summary
protected  void checkRep()
          Debugging function to check the representational invariant.
 BinaryLongMap getDelegateMap()
          Return the BinaryLongMap that provides the underlying storage for this MaskedLongMapHolder.
protected  MultiBinaryLongMap.MaskedBinaryLongMap instantiateMaskedBinaryLongMap(int cShift, int cBits)
          Factory method for instantiating MaskedBinaryLongMap instances associated with this MaskedLongMapHolder.
 boolean isEmpty()
          Return true iff all non-reserved bits are free (not in-use).
 boolean releaseMap(MultiBinaryLongMap.MaskedBinaryLongMap blm)
          Release a masked BLM that was reserved from this MaskedLongMapHolder.
 BinaryLongMap reserveMap(int cBits)
          Reserve and return a masked BLM from this MaskedLongMapHolder if available, or null otherwise.
protected  void shiftMaskedMap(MultiBinaryLongMap.MaskedBinaryLongMap blm, int cShiftRight)
          Shift the representation of the specified MaskedBinaryLongMap by the specified number of bits to the right.

 

Field Detail

m_listBLMs

protected java.util.List m_listBLMs
The list of reserved masked BLMs, ordered by increasing shift-position.

f_lMaskReserved

protected final long f_lMaskReserved
The bit-mask describing which bits in the underlying BLM representation are reserved (and may not be allocated by this holder).

m_lMaskFree

protected long m_lMaskFree
The bit-mask describing which bits in the underlying BLM representation are free.

f_lockS

protected final java.util.concurrent.locks.Lock f_lockS
The shared lock used to protected the logical contents of the maps exposed by this MaskedLongMapHolder.

f_lockX

protected final java.util.concurrent.locks.Lock f_lockX
The exclusive lock used to protected the logical contents of the maps exposed by this MaskedLongMapHolder.

f_blm

protected final BinaryLongMap f_blm
The BinaryLongMap shared by the component masked BLMs.

Constructor Detail

MultiBinaryLongMap.MaskedLongMapHolder

public MultiBinaryLongMap.MaskedLongMapHolder(BinaryLongMap blm,
                                              java.util.concurrent.locks.Lock lockSMaster)
Construct a MaskedLongMapHolder backed by the specified blm.
Parameters:
blm - the BinaryLongMap that the component masked maps are backed by
lockSMaster - the shared master-lock for the MultiBinaryLongMap

MultiBinaryLongMap.MaskedLongMapHolder

public MultiBinaryLongMap.MaskedLongMapHolder(BinaryLongMap blm,
                                              java.util.concurrent.locks.Lock lockSMaster,
                                              long lMaskReserved)
Construct a MaskedLongMapHolder backed by the specified blm with the specified reserved bit-mask.
Parameters:
blm - the BinaryLongMap that the component masked maps are backed by
lockSMaster - the shared master-lock for the MultiBinaryLongMap
lMaskReserved - the bit-mask representing the reserved bits

Method Detail

getDelegateMap

public BinaryLongMap getDelegateMap()
Return the BinaryLongMap that provides the underlying storage for this MaskedLongMapHolder.
Returns:
the underlying BinaryLongMap

reserveMap

public BinaryLongMap reserveMap(int cBits)
Reserve and return a masked BLM from this MaskedLongMapHolder if available, or null otherwise. Reserved maps must be released when no longer needed.
Parameters:
cBits - the number of bits to use to store each value
Returns:
a masked BLM, or null

releaseMap

public boolean releaseMap(MultiBinaryLongMap.MaskedBinaryLongMap blm)
Release a masked BLM that was reserved from this MaskedLongMapHolder.
Parameters:
blm - the masked BLM to release
Returns:
true iff the MaskedLongMapHolder becomes empty as a result

isEmpty

public boolean isEmpty()
Return true iff all non-reserved bits are free (not in-use).
Returns:
true iff all non-reserved bits are free (not in use)

instantiateMaskedBinaryLongMap

protected MultiBinaryLongMap.MaskedBinaryLongMap instantiateMaskedBinaryLongMap(int cShift,
                                                                                int cBits)
Factory method for instantiating MaskedBinaryLongMap instances associated with this MaskedLongMapHolder.
Parameters:
cShift - the shift position of the masked BLM
cBits - the bit-width of values represented by the BLM
Returns:
a MaskedBinaryLongMap with the specified shift and mask associated with this LongMapHolder (and backed by the underlying BLM)

shiftMaskedMap

protected void shiftMaskedMap(MultiBinaryLongMap.MaskedBinaryLongMap blm,
                              int cShiftRight)
Shift the representation of the specified MaskedBinaryLongMap by the specified number of bits to the right.

Note: the caller must hold exclusive access to the underlying BLM (and by extension, exclusive access to all derived masked maps).

Parameters:
blm - the MaskedBinaryLongMap to shift
cShiftRight - the number of bits to shift to the right

checkRep

protected void checkRep()
Debugging function to check the representational invariant.

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.