| java.lang.Object com.sleepycat.je.cleaner.OffsetList
OffsetList | public class OffsetList (Code) | | List of LSN offsets as a linked list of segments. The reasons for using a
list of this type and not a java.util.List are:
- Segements reduce memory overhead by storing long primitives rather than
Long objects. Many longs per segment reduce link overhead.
- Memory is only allocated for new segments, reducing the number of calls
to update the memory budget.
- This is an append-only list that supports a single appender thread and
multiple unsynchronized reader threads. The caller is responsible for
synchronizing such that only one thread calls add() at one time. The reader
threads see data as it is changing but do not see inconsistent data (corrupt
longs) and do not require synchronization for thread safety.
The algorithms here use traversal of the list segments rather than
recursion to avoid using a lot of stack space.
|
Inner Class :public static class Segment | |
Method Summary | |
public boolean | add(long value, boolean checkDupOffsets) Adds the given value and returns whether a new segment was allocated. | boolean | contains(long offset) Returns whether this list contains the given offset. | boolean | merge(OffsetList other) Merges the given list and returns whether a segment was freed. | public int | size() | public long[] | toArray() Returns an array of all values as longs. |
SEGMENT_CAPACITY | final static int SEGMENT_CAPACITY(Code) | | |
OffsetList | public OffsetList()(Code) | | |
add | public boolean add(long value, boolean checkDupOffsets)(Code) | | Adds the given value and returns whether a new segment was allocated.
|
contains | boolean contains(long offset)(Code) | | Returns whether this list contains the given offset.
|
merge | boolean merge(OffsetList other)(Code) | | Merges the given list and returns whether a segment was freed.
|
toArray | public long[] toArray()(Code) | | Returns an array of all values as longs. If a writer thread is
appending to the list while this method is excuting, some values may be
missing from the returned array, but the operation is safe.
|
|
|