Package org.agrona.concurrent
Interface Pipe<E>
- Type Parameters:
E
- type of the pipe elements.
- All Known Subinterfaces:
QueuedPipe<E>
- All Known Implementing Classes:
AbstractConcurrentArrayQueue
,ManyToManyConcurrentArrayQueue
,ManyToOneConcurrentArrayQueue
,OneToOneConcurrentArrayQueue
public interface Pipe<E>
A container for items exchanged from producers to consumers.
-
Method Summary
Modifier and TypeMethodDescriptionlong
The number of items added to this container since creation.int
capacity()
The maximum capacity of this container to hold items.int
Drain the number of elements present in a collection at the time the operation starts.int
Drain the minimum of a limit and the number of elements present in a collection at the time the operation starts.int
drainTo
(Collection<? super E> target, int limit) Drain available elements into the providedCollection
up to a provided maximum limit of elements.int
Get the remaining capacity for elements in the container given the current size.long
The number of items removed from this container since creation.int
size()
The number of items currently in the container.
-
Method Details
-
addedCount
long addedCount()The number of items added to this container since creation.- Returns:
- the number of items added.
-
removedCount
long removedCount()The number of items removed from this container since creation.- Returns:
- the number of items removed.
-
capacity
int capacity()The maximum capacity of this container to hold items.- Returns:
- the capacity of the container.
-
size
int size()The number of items currently in the container.- Returns:
- number of items currently in the container.
-
remainingCapacity
int remainingCapacity()Get the remaining capacity for elements in the container given the current size.- Returns:
- remaining capacity of the container.
-
drain
Drain the number of elements present in a collection at the time the operation starts.If possible, implementations should use smart batching to best handle burst traffic.
- Parameters:
elementConsumer
-Consumer
for processing elements.- Returns:
- the number of elements drained.
-
drain
Drain the minimum of a limit and the number of elements present in a collection at the time the operation starts.If possible, implementations should use smart batching to best handle burst traffic.
- Parameters:
elementConsumer
-Consumer
for processing elements.limit
- maximum number of elements to be drained in a drain operation.- Returns:
- the number of elements drained.
-
drainTo
Drain available elements into the providedCollection
up to a provided maximum limit of elements.If possible, implementations should use smart batching to best handle burst traffic.
- Parameters:
target
- in to which elements are drained.limit
- maximum number of elements to be drained in a drain operation.- Returns:
- the number of elements actually drained.
-