public class MemoryBasedHealthMonitor extends Object implements ExceptionHandler, LogTap
This will be inherently limited in size but should always contain the most recent logs and errors.
| Modifier and Type | Field and Description |
|---|---|
protected List<Incident> |
incidents |
protected List<LogMessage> |
messages |
| Constructor and Description |
|---|
MemoryBasedHealthMonitor() |
| Modifier and Type | Method and Description |
|---|---|
List<Incident> |
getIncidents()
Contains all recorded incidents.
|
List<LogMessage> |
getMessages()
Contains all recorded log messages.
|
long |
getNumIncidents()
Returns the total number of incidents (exceptions) encountered.
|
long |
getNumLogMessages()
Returns the total number of log messages encountered.
|
long |
getNumUniqueIncidents()
Returns the total number of unique incidents (with different locations) encountered.
|
void |
handle(Incident incident)
Invoked to handle the given exception.
|
void |
handleLogMessage(LogMessage msg)
Invoked once a log message is received.
|
protected final List<LogMessage> messages
public void handle(Incident incident) throws Exception
ExceptionHandlerCan be used to get notified about any exception which occurs in the system.
handle in interface ExceptionHandlerincident - contains the error description to be processed.Exception - as this method is already called from within the exception handling system, errors in here
should not be sent there again, but simply be thrown by this methodCallContext.getMDC(),
Exceptions.handle()public void handleLogMessage(LogMessage msg)
LogTaphandleLogMessage in interface LogTapmsg - the message to logpublic List<Incident> getIncidents()
public List<LogMessage> getMessages()
public long getNumLogMessages()
public long getNumIncidents()
public long getNumUniqueIncidents()
Copyright © 2018. All rights reserved.