Package org.apache.ignite.internal.util
Class GridCircularBuffer<T>
- java.lang.Object
-
- org.apache.ignite.internal.util.GridCircularBuffer<T>
-
public class GridCircularBuffer<T> extends Object
This class implements a circular buffer for efficient data exchange.
-
-
Constructor Summary
Constructors Constructor Description GridCircularBuffer(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tadd(T t)Tadd(T t, @Nullable IgniteInClosureX<T> c)voidforEach(IgniteInClosure<T> c)Executes given closure for every item in circular buffer.T2<T,Long>get(long idx)Collection<T>items()StringtoString()
-
-
-
Method Detail
-
items
public Collection<T> items()
- Returns:
- Items currently in buffer.
-
forEach
public void forEach(IgniteInClosure<T> c)
Executes given closure for every item in circular buffer.- Parameters:
c- Closure to execute.
-
add
@Nullable public T add(T t) throws InterruptedException
- Parameters:
t- Item to add.- Returns:
- Evicted object or
nullif nothing evicted. - Throws:
InterruptedException- If interrupted.
-
add
@Nullable public T add(T t, @Nullable @Nullable IgniteInClosureX<T> c) throws InterruptedException, IgniteCheckedException
- Parameters:
t- Item to add.c- Closure to by applied on evicted object before eviction.- Returns:
- Evicted object or
nullif nothing evicted. - Throws:
InterruptedException- If interrupted.IgniteCheckedException- If closure throws exception.
-
-