protected NotificationQueueHandler getHandlerForActiveQueue(final String compositeName) { synchronized (queues) { final NotificationQueue queue = queues.get(compositeName); if (queue == null || !queue.isStarted()) { return null; } return queue.getHandler(); } }
private List<NotificationEventModelDao> getReadyNotifications() { final List<NotificationEventModelDao> input = dao.getReadyEntries(); final List<NotificationEventModelDao> claimedNotifications = new ArrayList<NotificationEventModelDao>(); for (final NotificationEventModelDao cur : input) { // Skip non active queues... final NotificationQueue queue = queues.get(cur.getQueueName()); if (queue == null || !queue.isStarted()) { continue; } claimedNotifications.add(cur); } return claimedNotifications; }
@Override public void stopQueue() { if (config.isProcessingOff() || !isStarted()) { return; } // If there are no active queues left, stop the processing for the queues // (This is not intended to be robust against a system that would stop and start queues at the same time, // for a a normal shutdown sequence) // int nbQueueStarted = 0; synchronized (queues) { for (final NotificationQueue cur : queues.values()) { if (cur.isStarted()) { nbQueueStarted++; } } } if (nbQueueStarted == 0) { super.stopQueue(); } }
@Override @BeforeMethod(groups = "slow") public void beforeMethod() throws Exception { super.beforeMethod(); entitySqlDaoTransactionalJdbiWrapper = new EntitySqlDaoTransactionalJdbiWrapper(dbi, clock, cacheControllerDispatcher, nonEntityDao); overdueQueue = notificationQueueService.getNotificationQueue(DefaultOverdueService.OVERDUE_SERVICE_NAME, OverdueCheckNotifier.OVERDUE_CHECK_NOTIFIER_QUEUE); Assert.assertTrue(overdueQueue.isStarted()); testReferenceTime = clock.getUTCNow(); }