|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.logging.log4j.core.util.CyclicBuffer<T>
T
- The type of object stored in the buffer.public final class CyclicBuffer<T>
A bounded buffer containing elements of type T. When the number of elements to be added will exceed the size of the buffer the oldest element will be overwritten. Access to the buffer is thread safe.
Constructor Summary | |
---|---|
CyclicBuffer(Class<T> clazz,
int size)
Instantiate a new CyclicBuffer of at most maxSize events. |
Method Summary | |
---|---|
void |
add(T item)
Add an item as the last event in the buffer. |
boolean |
isEmpty()
Determines if the buffer contains elements. |
T[] |
removeAll()
Removes all the elements from the buffer and returns them. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CyclicBuffer(Class<T> clazz, int size) throws IllegalArgumentException
maxSize
events.
clazz
- The Class associate with the type of object in the buffer.size
- The number of items in the buffer.
IllegalArgumentException
- if the size is negative.Method Detail |
---|
public void add(T item)
item
- The item to add to the buffer.public T[] removeAll()
public boolean isEmpty()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.