@InterfaceAudience.Private public class MemoryBoundedLogMessageBuffer extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
MemoryBoundedLogMessageBuffer.LogMessage |
Modifier and Type | Field and Description |
---|---|
private long |
maxSizeBytes |
private LinkedList<MemoryBoundedLogMessageBuffer.LogMessage> |
messages |
private long |
usage |
Constructor and Description |
---|
MemoryBoundedLogMessageBuffer(long maxSizeBytes) |
Modifier and Type | Method and Description |
---|---|
void |
add(String messageText)
Append the given message to this buffer, automatically evicting
older messages until the desired memory limit is achieved.
|
void |
dumpTo(PrintWriter out)
Dump the contents of the buffer to the given stream.
|
(package private) long |
estimateHeapUsage()
Estimate the number of bytes this buffer is currently
using.
|
(package private) List<MemoryBoundedLogMessageBuffer.LogMessage> |
getMessages() |
private final long maxSizeBytes
private long usage
private LinkedList<MemoryBoundedLogMessageBuffer.LogMessage> messages
public MemoryBoundedLogMessageBuffer(long maxSizeBytes)
public void add(String messageText)
public void dumpTo(PrintWriter out)
List<MemoryBoundedLogMessageBuffer.LogMessage> getMessages()
long estimateHeapUsage()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.