Class UnsettledMap<Delivery>
java.lang.Object
org.apache.qpid.protonj2.engine.util.UnsettledMap<Delivery>
- Type Parameters:
Delivery
- The delivery type being tracker (incoming or outgoing)
- All Implemented Interfaces:
Map<UnsignedInteger,
Delivery>
A specialized collection like entity that is used to keep track of unsettled
incoming and outgoing deliveries for AMQP links and the sessions that manage
those links.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static interface
-
Field Summary
Modifier and TypeFieldDescriptionprotected Set<Map.Entry<UnsignedInteger,
Delivery>> protected Set<UnsignedInteger>
protected Collection<Delivery>
-
Constructor Summary
ConstructorDescriptionUnsettledMap
(UnsettledMap.UnsettledGetDeliveryId<Delivery> idSupplier) UnsettledMap
(UnsettledMap.UnsettledGetDeliveryId<Delivery> idSupplier, int initialBuckets) UnsettledMap
(UnsettledMap.UnsettledGetDeliveryId<Delivery> idSupplier, int initialBuckets, int bucketSize) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(int key) boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
void
Visits each entry within the given range and invokes the provided action on each delivery in the tracker.void
forEach
(BiConsumer<? super UnsignedInteger, ? super Delivery> action) void
get
(int deliveryId) boolean
isEmpty()
keySet()
Adds the given key and value pair in this tracking structure at the end of the current series.put
(UnsignedInteger key, Delivery value) void
putAll
(Map<? extends UnsignedInteger, ? extends Delivery> source) remove
(int deliveryId) void
removeEach
(int first, int last, Consumer<Delivery> action) Remove each entry within the given range of delivery IDs.int
size()
toString()
values()
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
keySet
-
values
-
entrySet
-
-
Constructor Details
-
UnsettledMap
-
UnsettledMap
-
UnsettledMap
public UnsettledMap(UnsettledMap.UnsettledGetDeliveryId<Delivery> idSupplier, int initialBuckets, int bucketSize)
-
-
Method Details
-
putAll
- Specified by:
putAll
in interfaceMap<UnsignedInteger,
Delivery>
-
clear
public void clear()- Specified by:
clear
in interfaceMap<UnsignedInteger,
Delivery>
-
put
- Specified by:
put
in interfaceMap<UnsignedInteger,
Delivery>
-
put
Adds the given key and value pair in this tracking structure at the end of the current series.If the map previously contained a mapping for the key, the old value is not replaced by the specified value unlike a traditional map as this structure is tracking the running series of values. This would imply that duplicates can exist in the tracker, however given the likelihood of this occurring in the normal flow of deliveries should be considered extremely low.
- Parameters:
deliveryId
- The delivery ID of the delivery being added to this tracker.delivery
- The delivery that is being added to the tracker- Returns:
- null in all cases as this tracker does not check for duplicates.
-
size
public int size()- Specified by:
size
in interfaceMap<UnsignedInteger,
Delivery>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceMap<UnsignedInteger,
Delivery>
-
get
- Specified by:
get
in interfaceMap<UnsignedInteger,
Delivery>
-
get
-
remove
- Specified by:
remove
in interfaceMap<UnsignedInteger,
Delivery>
-
remove
-
containsKey
- Specified by:
containsKey
in interfaceMap<UnsignedInteger,
Delivery>
-
containsKey
public boolean containsKey(int key) -
containsValue
- Specified by:
containsValue
in interfaceMap<UnsignedInteger,
Delivery>
-
forEach
-
forEach
Visits each entry within the given range and invokes the provided action on each delivery in the tracker.- Parameters:
first
- The first entry to visit.last
- The last entry to visit.action
- The action to invoke on each visited entry.
-
removeEach
Remove each entry within the given range of delivery IDs. For each entry removed the provided action is triggered allowing the caller to be notified of each removal.- Parameters:
first
- The first entry to removelast
- The last entry to removeaction
- The action to invoke on each remove.
-
forEach
- Specified by:
forEach
in interfaceMap<UnsignedInteger,
Delivery>
-
values
- Specified by:
values
in interfaceMap<UnsignedInteger,
Delivery>
-
keySet
- Specified by:
keySet
in interfaceMap<UnsignedInteger,
Delivery>
-
entrySet
- Specified by:
entrySet
in interfaceMap<UnsignedInteger,
Delivery>
-
equals
-
toString
-