java.lang.Object
com.aoindustries.noc.monitor.portmon.PortMonitor
com.aoindustries.noc.monitor.portmon.JdbcPortMonitor
Direct Known Subclasses:
MysqlPortMonitor, PostgresqlPortMonitor

public abstract class JdbcPortMonitor extends PortMonitor
Monitors a database over JDBC.
Author:
AO Industries, Inc.
  • Field Details

    • TIMEOUT

      protected static final int TIMEOUT
      See Also:
    • readOnly

      protected final boolean readOnly
  • Constructor Details

    • JdbcPortMonitor

      protected JdbcPortMonitor(InetAddress ipAddress, Port port, URIParameters monitoringParameters)
      Creates a new JDBC monitor.
  • Method Details

    • checkPort

      public final String checkPort() throws Exception
      Description copied from class: PortMonitor
      Checks the port. This may take arbitrarily long to complete, and any timeout should be provided externally and call the cancel method. If any error occurs, must throw an exception.
      Specified by:
      checkPort in class PortMonitor
      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 class PortMonitor
      See Also:
    • getDriver

      protected abstract String getDriver()
      Gets the driver classname.
    • getJdbcUrl

      protected abstract String getJdbcUrl(InetAddress ipAddress, int port, String database)
      Generates the JDBC URL.
    • getDefaultUsername

      protected abstract String getDefaultUsername()
    • getDefaultDatabase

      protected abstract String getDefaultDatabase()
    • getDefaultQuery

      protected String getDefaultQuery()