001package io.ebean.datasource;
002
003import javax.sql.DataSource;
004import java.sql.SQLException;
005
006/**
007 * Listener for notifications about the DataSource such as when the DataSource
008 * goes down, up or gets close to it's maximum size.
009 * <p>
010 * The intention is to send email notifications to an administrator (or similar)
011 * when these events occur on the DataSource.
012 * </p>
013 */
014public interface DataSourceAlert {
015
016  /**
017   * Send an alert to say the dataSource is back up.
018   */
019  void dataSourceUp(DataSource dataSource);
020
021  /**
022   * Send an alert to say the dataSource is down.
023   */
024  void dataSourceDown(DataSource dataSource, SQLException reason);
025
026  /**
027   * Send an alert to say the dataSource is getting close to its max size.
028   */
029  void dataSourceWarning(DataSource dataSource, String msg);
030}