class MonitorImpl extends Object implements Monitor
Internally, uses a dedicated thread to process events. Events received from log4j are placed on a queue. This "Active object" or "Actor" pattern means that the data structures that hold counters do not need to be locked.
Command requests are treated like events. They place their result on a result queue.
A visitor
quickly dispatches events and commands
to the appropriate handler method.
The monitored objects form a hierarchy. For each object type, there is
a mutable workspace (whose members are private and non-final) that is
converted into a monitor object (whose members are public and final) when
its fix()
method is called:
MutableServerInfo
→ ServerInfo
MutableConnectionInfo
→ ConnectionInfo
MutableStatementInfo
→ StatementInfo
MutableExecutionInfo
→ ExecutionInfo
MutableSqlStatementInfo
→ SqlStatementInfo
Modifier and Type | Class and Description |
---|---|
(package private) static class |
MonitorImpl.Command
A kind of message that produces a response.
|
(package private) static interface |
MonitorImpl.CommandVisitor<T>
Extension to
Visitor to allow commands as well as events. |
(package private) static class |
MonitorImpl.ConnectionsCommand |
(package private) static class |
MonitorImpl.ServerCommand |
(package private) static class |
MonitorImpl.ShutdownCommand |
(package private) static class |
MonitorImpl.SqlStatementsCommand |
(package private) static class |
MonitorImpl.StatementsCommand |
Modifier and Type | Field and Description |
---|---|
protected static Util.MemoryInfo |
MEMORY_INFO |
Constructor and Description |
---|
MonitorImpl()
Creates a Monitor.
|
Modifier and Type | Method and Description |
---|---|
List<ConnectionInfo> |
getConnections() |
ServerInfo |
getServer() |
List<SqlStatementInfo> |
getSqlStatements() |
List<StatementInfo> |
getStatements() |
void |
sendEvent(Event event)
Sends an event to the monitor.
|
void |
shutdown() |
protected static final Util.MemoryInfo MEMORY_INFO
public void shutdown()
public void sendEvent(Event event)
Monitor
public ServerInfo getServer()
public List<ConnectionInfo> getConnections()
getConnections
in interface Monitor
public List<StatementInfo> getStatements()
getStatements
in interface Monitor
public List<SqlStatementInfo> getSqlStatements()
getSqlStatements
in interface Monitor