public class BoundedFIFO extends Object
Constructor and Description |
---|
BoundedFIFO(int maxSize)
Constructs a new instance with a maximum size passed as argument.
|
Modifier and Type | Method and Description |
---|---|
LoggingEvent |
get()
Gets the first element in the buffer.
|
int |
getMaxSize()
Gets the maximum size of the buffer.
|
boolean |
isFull()
Returns
true if the buffer is full, that is, whether the number of elements in the buffer equals the
buffer size. |
int |
length()
Gets the number of elements in the buffer.
|
void |
put(LoggingEvent o)
Puts a
LoggingEvent in the buffer. |
void |
resize(int newSize)
Resizes the buffer to a new size.
|
boolean |
wasEmpty()
Returns
true if there is just one element in the buffer. |
boolean |
wasFull()
Returns
true if the number of elements in the buffer plus 1 equals the maximum buffer size, returns
false otherwise. |
public BoundedFIFO(int maxSize)
public LoggingEvent get()
null
if there are no elements in the buffer.public int getMaxSize()
public boolean isFull()
true
if the buffer is full, that is, whether the number of elements in the buffer equals the
buffer size.public int length()
maxSize
(inclusive).public void put(LoggingEvent o)
LoggingEvent
in the buffer. If the buffer is full then the event is silently dropped. It is the
caller's responsability to make sure that the buffer has free space.public void resize(int newSize)
public boolean wasEmpty()
true
if there is just one element in the buffer. In other words, if there were no elements
before the last put(org.apache.log4j.spi.LoggingEvent)
operation completed.public boolean wasFull()
true
if the number of elements in the buffer plus 1 equals the maximum buffer size, returns
false
otherwise.Copyright © 1999-2022 The 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.