public abstract class AbstractWriterStatistics 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 |
|---|
AbstractWriterStatistics() |
| Modifier and Type | Method and Description |
|---|---|
int |
getLastBatchSize() |
Throwable |
getLastError() |
String |
getLastErrorMessage() |
List<String> |
getLastErrorStacktrace() |
Date |
getLastErrorTimestamp() |
int |
getMessagesDiscarded() |
int |
getMessagesRequeuedLastBatch() |
int |
getMessagesSent() |
int |
getMessagesSentLastBatch() |
int |
getOversizeMessages() |
int |
getThrottledWrites() |
void |
incrementOversizeMessages() |
void |
incrementThrottledWrites() |
void |
setLastBatchSize(int count) |
void |
setLastError(String message,
Throwable error)
Sets the last error.
|
void |
setMessageQueue(MessageQueue messageQueue)
Stores the current writer's message queue.
|
void |
setMessagesRequeuedLastBatch(int count) |
void |
setMessagesSentLastBatch(int count) |
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)
Note: if multiple errors occur in rapid succession, the observer may see a mixture of reported values. This is unlikely to occur outside of testing, and the cure is to syncronize this method with the various gets, which I don't particularly want to do.
public Throwable getLastError()
public String getLastErrorMessage()
public Date getLastErrorTimestamp()
public void incrementOversizeMessages()
public int getOversizeMessages()
public void updateMessagesSent(int count)
public int getMessagesSent()
public void setLastBatchSize(int count)
public int getLastBatchSize()
public void setMessagesSentLastBatch(int count)
public int getMessagesSentLastBatch()
public void setMessagesRequeuedLastBatch(int count)
public int getMessagesRequeuedLastBatch()
public int getMessagesDiscarded()
public int getThrottledWrites()
public void incrementThrottledWrites()
Copyright © 2023. All rights reserved.