@ParametersAreNonnullByDefault public class OffsetQueueImpl<T> extends Object implements OffsetQueue<T>, OffsetQueueImplMBean
| Constructor and Description |
|---|
OffsetQueueImpl() |
| Modifier and Type | Method and Description |
|---|---|
T |
getHeadItem()
Return the item with the smallest offset in the queue.
|
Iterable<T> |
getHeadItems(int skip,
int limit)
Return #limit items after skipping #skip items from the queue.
|
long |
getHeadOffset() |
T |
getItem(long offset)
Return the item at the given #offset.
|
OffsetQueue<T> |
getMinOffsetQueue(long minOffset)
Return an
OffsetQueue offset queue which
contains all the items from the current queue at
an offset greater or equal to #minOffset. |
int |
getSize() |
long |
getTailOffset() |
boolean |
isEmpty() |
void |
putItem(long offset,
T item)
Put an item in the queue at the given offset.
|
void |
putItems(OffsetQueue<T> offsetQueue)
Put all the items from the #offsetQueue in this queue.
|
public void putItem(long offset,
T item)
OffsetQueueputItem in interface OffsetQueue<T>offset - the offset associated to the itemitem - the item to be stored at the given offsetpublic void putItems(OffsetQueue<T> offsetQueue)
OffsetQueueputItems in interface OffsetQueue<T>offsetQueue - the queue to be merged into this queuepublic T getItem(long offset)
OffsetQueuegetItem in interface OffsetQueue<T>offset - the offset of the item to be returnednull if no item could be found
at the given offsetpublic T getHeadItem()
OffsetQueuegetHeadItem in interface OffsetQueue<T>null if the queue is empty@Nonnull public Iterable<T> getHeadItems(int skip, int limit)
OffsetQueuegetHeadItems in interface OffsetQueue<T>skip - the number of items to skiplimit - the maximum number of items to return. -1 will return all items.public long getHeadOffset()
getHeadOffset in interface OffsetQueueImplMBeangetHeadOffset in interface OffsetQueue<T>-1 if the queue is empty.public long getTailOffset()
getTailOffset in interface OffsetQueueImplMBeangetTailOffset in interface OffsetQueue<T>-1 if the queue is empty.public boolean isEmpty()
isEmpty in interface OffsetQueue<T>true if the queue is empty ;
false otherwisepublic int getSize()
getSize in interface OffsetQueueImplMBeangetSize in interface OffsetQueue<T>@Nonnull public OffsetQueue<T> getMinOffsetQueue(long minOffset)
OffsetQueueOffsetQueue offset queue which
contains all the items from the current queue at
an offset greater or equal to #minOffset.getMinOffsetQueue in interface OffsetQueue<T>minOffset - the minimal offset of the items
in the returned offset queueCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.