Package io.confluent.parallelconsumer
Class CountingCRLinkedList<K,V>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.AbstractSequentialList<E>
java.util.LinkedList<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>
io.confluent.parallelconsumer.CountingCRLinkedList<K,V>
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>,java.util.Collection<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>,java.util.Deque<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>,java.util.List<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>,java.util.Queue<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>
public class CountingCRLinkedList<K,V>
extends java.util.LinkedList<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>
implements java.util.Queue<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>
Cached view of the nested number of records in this queue.
Also protects against concurrent modification exceptions, as we don't need to traverse the list to count the nested elements. The count won't then be always exact, but it doesn't need to be.
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description CountingCRLinkedList() -
Method Summary
Modifier and Type Method Description voidadd(int index, org.apache.kafka.clients.consumer.ConsumerRecords<K,V> element)booleanadd(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> element)protected booleancanEqual(java.lang.Object other)booleanequals(java.lang.Object o)intgetNestedCount()The number of nestedConsumerRecordin this collection.inthashCode()org.apache.kafka.clients.consumer.ConsumerRecords<K,V>poll()Methods inherited from class java.util.LinkedList
addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArrayMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
-
Constructor Details
-
CountingCRLinkedList
public CountingCRLinkedList()
-
-
Method Details
-
add
-
add
- Specified by:
addin interfacejava.util.Collection<K>- Specified by:
addin interfacejava.util.Deque<K>- Specified by:
addin interfacejava.util.List<K>- Specified by:
addin interfacejava.util.Queue<K>- Overrides:
addin classjava.util.LinkedList<org.apache.kafka.clients.consumer.ConsumerRecords<K,V>>
-
poll
-
equals
public boolean equals(java.lang.Object o) -
canEqual
protected boolean canEqual(java.lang.Object other) -
hashCode
public int hashCode() -
getNestedCount
public int getNestedCount()The number of nestedConsumerRecordin this collection. As this is a non blocking collection, this won't be exact.
-