E
- type of items in the pipe.public interface Pipe<E>
Queue
adding
methods that make sense for a queue which is concurrent, bounded, and
supports draining in batches.Modifier and Type | Method and Description |
---|---|
long |
addedCount()
Returns the number of items added to this pipe since creation.
|
int |
capacity()
Returns the number of items this pipe can hold at a time.
|
int |
drain(Predicate<? super E> itemHandler)
Drains the items available in the pipe to the supplied item handler.
|
int |
drainTo(Collection<? super E> target,
int limit)
Drains at most
limit available items into the provided
Collection . |
int |
remainingCapacity()
Returns the number of items this pipe has still room for.
|
long |
removedCount()
Returns the number of items removed from this pipe since creation.
|
long addedCount()
long removedCount()
int capacity()
int remainingCapacity()
int drain(Predicate<? super E> itemHandler)
boolean
which decides whether to continue
draining. If it returns false
, this method refrains from draining
further items and returns.
Implementation note: this method is expected to take advantage of the fact that many items are being drained at once and minimize the per-item cost of housekeeping.
itemHandler
- the item handlerint drainTo(Collection<? super E> target, int limit)
limit
available items into the provided
Collection
.
Implementation note: this method is expected to take advantage of the fact that many items are being drained at once and minimize the per-item cost of housekeeping.
target
- destination for the drained itemslimit
- the maximum number of items to drainCopyright © 2020 Hazelcast, Inc.. All Rights Reserved.