/** * <p>getAutoAcknowledges</p> * * @return a {@link java.util.Collection} object. * @throws java.io.IOException if any. */ public Collection<AutoAcknowledge> getAutoAcknowledges() throws IOException { return getConfiguration().getAutoAcknowledges(); }
/** * <p>getOutageCalendarNames</p> * * @return a {@link java.util.Collection} object. * @throws java.io.IOException if any. */ public Collection<String> getOutageCalendarNames() throws IOException { return getConfiguration().getOutageCalendars(); } }
/** * <p>getNextUserNotifIdSql</p> * * @return a {@link java.lang.String} object. * @throws java.io.IOException if any. */ public String getNextUserNotifIdSql() throws IOException { return getConfiguration().getNextUserNotifId(); }
/** * <p>getNextNotifIdSql</p> * * @throws java.io.IOException if any. * @return a {@link java.lang.String} object. */ public String getNextNotifIdSql() throws IOException { return getConfiguration().getNextNotifId(); }
private void setupThreadPool() throws IOException { // determine the size of the thread pool final int maxThreads = getNotifdConfigManager().getConfiguration().getMaxThreads(); // enforce no limit when the value is <= 0 final int effectiveMaxThreads = maxThreads > 0 ? maxThreads : Integer.MAX_VALUE; // make it easier to identify the notification task threads final ThreadFactory threadFactory = new ThreadFactoryBuilder() .setNameFormat("NotificationTask-%d") .build(); // use an unbounded queue to hold any additional tasks // this may not ideal, but it's safer than the previous approach of immediately // creating a thread for every task final BlockingQueue<Runnable> queue = new LinkedBlockingQueue<>(); // create the thread pool that enforces a ceiling on the number of concurrent threads m_notificationTaskExecutor = new ThreadPoolExecutor(effectiveMaxThreads, effectiveMaxThreads, 60L, TimeUnit.SECONDS, queue, threadFactory); m_notificationTaskExecutor.allowCoreThreadTimeOut(true); }
final PreparedStatement update = connection.prepareStatement(getConfigManager().getConfiguration().getAcknowledgeUpdateSql()); dbUtils.watch(update); update.setString(1, ansBy);
connection = getConnection(); d.watch(connection); final PreparedStatement statement = connection.prepareStatement(getConfigManager().getConfiguration().getOutstandingNoticesSql()); d.watch(statement);
LOG.info("Notification status = {}", getConfigManager().getNotificationStatus()); final List<Queue> queues = getConfigManager().getConfiguration().getQueues(); for (final Queue queue : queues) { final NoticeQueue curQueue = new NoticeQueue();
sendResolvedNotifications(notifIDs, event, curAck.getResolutionPrefix(), getNotifdConfigManager().getConfiguration().getNumericSkipResolutionPrefix()); return; if (!getNotifdConfigManager().getConfiguration().getAutoAcknowledgeAlarm().isPresent()) { return; final AutoAcknowledgeAlarm autoAck = getNotifdConfigManager().getConfiguration().getAutoAcknowledgeAlarm().get(); if ( !autoAck.getUeis().isEmpty() && !autoAck.getUeis().contains(event.getUei()) ) { return; sendResolvedNotifications(notifIDs, event, autoAck.getResolutionPrefix(), getNotifdConfigManager().getConfiguration().getNumericSkipResolutionPrefix());
} else if (targetName.indexOf('@') > -1) { String[] emailCommands = { getNotifdConfigManager().getConfiguration().getEmailAddressCommand() }; NotificationTask[] emailTasks = { makeEmailTask(startTime, params, noticeId, targetName, emailCommands, targetSiblings, autoNotify) }; tasks = emailTasks;
@Test public void testRebuildParameterMap() throws Exception { MockInterface iface = m_network.getInterface(1, "192.168.1.1"); Date downDate = new Date(); anticipateNotificationsForGroup("interface 192.168.1.1 down.", "All services are down on interface 192.168.1.1", "InitialGroup", downDate, 0); //bring node down now Event event = iface.createDownEvent(downDate); m_eventMgr.sendEventToListeners(event); sleep(1000); Collection<Integer> notifIds = m_db.findNoticesForEvent(event); Notification[] notification = m_notificationManager.getNotifForEvent(event); int index = 0; for (Integer notifId : notifIds) { Map<String, String> originalMap = m_eventProcessor.buildParameterMap(notification[index], event, notifId.intValue()); Map<String, String> resolutionMap = new HashMap<String, String>(originalMap); resolutionMap.put(NotificationManager.PARAM_SUBJECT, "RESOLVED: "+resolutionMap.get(NotificationManager.PARAM_SUBJECT)); resolutionMap.put(NotificationManager.PARAM_TEXT_MSG, "RESOLVED: "+resolutionMap.get(NotificationManager.PARAM_TEXT_MSG)); resolutionMap.put(NotificationManager.PARAM_NUM_MSG, "RESOLVED: "+resolutionMap.get(NotificationManager.PARAM_NUM_MSG)); Map<String, String> rebuiltMap = m_notifd.getBroadcastEventProcessor().rebuildParameterMap(notifId.intValue(), "RESOLVED: ", m_notifd.getConfigManager().getConfiguration().getNumericSkipResolutionPrefix()); assertEquals(resolutionMap, rebuiltMap); index++; } }