Class JdbcPortMonitor
java.lang.Object
com.aoindustries.noc.monitor.portmon.PortMonitor
com.aoindustries.noc.monitor.portmon.JdbcPortMonitor
- Direct Known Subclasses:
MysqlPortMonitor
,PostgresqlPortMonitor
Monitors a database over JDBC.
- Author:
- AO Industries, Inc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final boolean
protected static final int
Fields inherited from class com.aoindustries.noc.monitor.portmon.PortMonitor
canceled, CRLF, ipAddress, port
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
JdbcPortMonitor
(InetAddress ipAddress, Port port, URIParameters monitoringParameters) Creates a new JDBC monitor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancels this port method on a best effort basis.final String
Checks the port.protected abstract String
Gets the default JDBC database.protected String
protected abstract String
Gets the default JDBC username.protected abstract String
Gets the driver classname.protected abstract String
getJdbcUrl
(InetAddress ipAddress, int port, String database) Generates the JDBC URL.Methods inherited from class com.aoindustries.noc.monitor.portmon.PortMonitor
getPortMonitor, readLine
-
Field Details
-
TIMEOUT
protected static final int TIMEOUT- See Also:
-
readOnly
protected final boolean readOnly
-
-
Constructor Details
-
JdbcPortMonitor
Creates a new JDBC monitor.
-
-
Method Details
-
checkPort
Description copied from class:PortMonitor
Checks the port. This may take arbitrarily long to complete, and any timeout should be provided externally and call thecancel
method. If any error occurs, must throw an exception.- Specified by:
checkPort
in classPortMonitor
- Returns:
- the message indicating success
- Throws:
Exception
- See Also:
-
cancel
public void cancel()Description copied from class:PortMonitor
Cancels this port method on a best effort basis. This will not necessarily cause the checkPort method to return immediately. This should only be used once the result of checkPort is no longer relevant, such as after a timeout. Some monitors may still perform their task arbitrarily long after cancel has been called.It is critical that subclass implementations of this method not block in any way.
- Overrides:
cancel
in classPortMonitor
- See Also:
-
getDriver
Gets the driver classname. -
getJdbcUrl
Generates the JDBC URL. -
getDefaultUsername
Gets the default JDBC username. -
getDefaultDatabase
Gets the default JDBC database. -
getDefaultQuery
-