Search in sources :

Example 1 with AlertNotifyReceiver

use of com.thinkbiganalytics.alerts.spi.AlertNotifyReceiver in project kylo by Teradata.

the class InMemoryAlertManager method signalReceivers.

private void signalReceivers() {
    Executor exec = getRespondersExecutor();
    final Set<AlertNotifyReceiver> receivers;
    synchronized (this.alertReceivers) {
        receivers = new HashSet<>(this.alertReceivers);
    }
    exec.execute(() -> {
        int count = InMemoryAlertManager.this.changeCount.get();
        LOG.info("Notifying receivers: {} about events: {}", receivers.size(), count);
        for (AlertNotifyReceiver receiver : receivers) {
            receiver.alertsAvailable(count);
        }
        InMemoryAlertManager.this.changeCount.getAndAdd(-count);
    });
}
Also used : AlertNotifyReceiver(com.thinkbiganalytics.alerts.spi.AlertNotifyReceiver) Executor(java.util.concurrent.Executor)

Aggregations

AlertNotifyReceiver (com.thinkbiganalytics.alerts.spi.AlertNotifyReceiver)1 Executor (java.util.concurrent.Executor)1