org.apache.log4j.helpers
public class CyclicBuffer extends Object
This buffer gives read access to any element in the buffer not just the first or last element.
Since: 0.9.0
Constructor Summary | |
---|---|
CyclicBuffer(int maxSize)
Instantiate a new CyclicBuffer of at most maxSize events.
|
Method Summary | |
---|---|
void | add(LoggingEvent event)
Add an event as the last event in the buffer. |
LoggingEvent | get(int i)
Get the ith oldest event currently in the buffer. |
LoggingEvent | get()
Get the oldest (first) element in the buffer. |
int | getMaxSize() |
int | length()
Get the number of elements in the buffer. |
void | resize(int newSize)
Resize the cyclic buffer to newSize . |
maxSize
events.
The maxSize
argument must a positive integer.Parameters: maxSize The maximum number of elements in the buffer.
event
as the last event in the buffer.null
is returned.maxSize
(inclusive).newSize
.Throws: IllegalArgumentException if newSize
is negative.