Package org.teiid.common.buffer.impl
Class ConcurrentBitSet
- java.lang.Object
-
- org.teiid.common.buffer.impl.ConcurrentBitSet
-
-
Constructor Summary
Constructors Constructor Description ConcurrentBitSet(int maxBits, int concurrencyLevel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear(int bitIndex)
int
compactHighestBitSet(int segment)
int
getAndSetNextClearBit()
Makes a best effort to atomically find the next clear bit and set itint
getAndSetNextClearBit(int segment)
int
getBitsPerSegment()
int
getBitsSet()
int
getBitsSet(int segment)
return an estimate of the number of bits setint
getHighestBitSet(int segment)
return an estimate of the highest bit (relative index) that has been setint
getNextSegment()
int
getTotalBits()
void
setCompact(boolean compact)
Set to always allocate against the first available block in a segment.String
toString()
-
-
-
Method Detail
-
clear
public void clear(int bitIndex)
-
getAndSetNextClearBit
public int getAndSetNextClearBit()
Makes a best effort to atomically find the next clear bit and set it- Returns:
- the next bit index or -1 if no clear bits are found
-
getNextSegment
public int getNextSegment()
-
getBitsSet
public int getBitsSet(int segment)
return an estimate of the number of bits set- Parameters:
segment
-- Returns:
-
getHighestBitSet
public int getHighestBitSet(int segment)
return an estimate of the highest bit (relative index) that has been set- Parameters:
segment
-- Returns:
-
getAndSetNextClearBit
public int getAndSetNextClearBit(int segment)
- Parameters:
segment
-- Returns:
- the next clear bit index as an absolute index - not relative to a segment
-
getTotalBits
public int getTotalBits()
-
getBitsSet
public int getBitsSet()
-
getBitsPerSegment
public int getBitsPerSegment()
-
setCompact
public void setCompact(boolean compact)
Set to always allocate against the first available block in a segment.- Parameters:
compact
-
-
compactHighestBitSet
public int compactHighestBitSet(int segment)
-
-