E
- the allowed type for this accumulator to accumulate.public interface Accumulator<E extends Sequenced> extends Iterable<E>
reset()
method.Sequenced
Modifier and Type | Method and Description |
---|---|
void |
accumulate(E event)
Adds event to this accumulator.
|
AccumulatorInfo |
getInfo()
Returns
AccumulatorInfo of this accumulator. |
boolean |
isEmpty()
Returns true if this accumulator contains no elements.
|
Iterator<E> |
iterator()
Returns an iterator over the items in this accumulator in proper sequence.
|
int |
poll(AccumulatorHandler<E> handler,
int maxItems)
Reads this accumulator if it contains at least
maxItems , otherwise
do not read anything. |
int |
poll(AccumulatorHandler<E> handler,
long delay,
TimeUnit unit)
Reads all expired items to the supplied handler.
|
void |
reset()
Resets this accumulator.
|
boolean |
setHead(long sequence)
Tries to set head of this accumulator to the supplied
sequence and returns true ,
if that sequence is still exist in this accumulator. |
int |
size()
Current size of accumulator.
|
forEach, spliterator
void accumulate(E event)
event
- event to add.int poll(AccumulatorHandler<E> handler, int maxItems)
maxItems
, otherwise
do not read anything. If this method adds items to the supplied handler, head of this accumulator advances.
Used for batching purposes.handler
- handler to process this accumulator.maxItems
- read this accumulator if it contains at least maxItems
int poll(AccumulatorHandler<E> handler, long delay, TimeUnit unit)
handler
- handler to process this accumulator.delay
- after this duration element will be poll-able.unit
- time-unitIterator<E> iterator()
AccumulatorInfo getInfo()
AccumulatorInfo
of this accumulator.AccumulatorInfo
of this accumulator.boolean setHead(long sequence)
sequence
and returns true
,
if that sequence
is still exist in this accumulator. Otherwise, returns false
.sequence
- the sequence number which will be the head of this accumulator.true
if sequence
is set, otherwise returns false
int size()
boolean isEmpty()
void reset()
Copyright © 2021 Hazelcast, Inc.. All Rights Reserved.