package notify;

import java.sql.*;

/**
 *
 * @author chmelarp
 */
class Notifier extends Thread {

    private String notifyName;
    private Connection conn;

    public Notifier(Connection conn, String nameOfTheNotify) {
        this.conn = conn;
        this.notifyName = nameOfTheNotify;
    }

    public void run() {
        while (true) {
            try {
                Statement stmt = conn.createStatement();
                stmt.execute("NOTIFY "+ notifyName);
                stmt.close();
            } catch (SQLException sqle) {
                sqle.printStackTrace();
            }
        }
    }
}
