public abstract class AbstractAppenderStatistics extends Object
Statistics are limited to primitives and strings so that they can be read by JMX. Statistics will be read and written by different threads, so must be marked as volatile. A given statistic will only be written by appender or writer, not both, so there's no need for synchronization unless there's the possibility of multiple writers. In that case, implement an override in the subclass and synchronize there.
Note: the MXBean interface implemented by subclasses must explicitly expose any desired getters (we can't use a superinterface because JMX introspection only looks at declared methods).
| Constructor and Description |
|---|
AbstractAppenderStatistics() |
| Modifier and Type | Method and Description |
|---|---|
Throwable |
getLastError() |
String |
getLastErrorMessage() |
List<String> |
getLastErrorStacktrace() |
Date |
getLastErrorTimestamp() |
int |
getMessagesDiscarded()
Returns the number of messages discarded by the current writer's message queue.
|
int |
getMessagesSent() |
void |
setLastError(String message,
Throwable error)
Sets the last error.
|
void |
setMessageQueue(MessageQueue messageQueue)
Stores the current writer's message queue.
|
void |
updateMessagesSent(int count)
Updates the number of messages sent with the given count.
|
public void setMessageQueue(MessageQueue messageQueue)
public void setLastError(String message, Throwable error)
public Throwable getLastError()
public String getLastErrorMessage()
public Date getLastErrorTimestamp()
public void updateMessagesSent(int count)
public int getMessagesSent()
public int getMessagesDiscarded()
Copyright © 2018. All rights reserved.