@Override public Map<PluginKey, List<NotificationInfo>> getByUser( NotificationContext context, UserSetting setting) { boolean created = NotificationSessionManager.createSystemProvider(); SessionProvider sProvider = NotificationSessionManager.getSessionProvider(); Map<PluginKey, List<NotificationInfo>> notificationData = new LinkedHashMap<PluginKey, List<NotificationInfo>>(); try { boolean isWeekly = context.value(NotificationJob.JOB_WEEKLY); if (isWeekly) { for (String pluginId : setting.getWeeklyPlugins()) { putMap( notificationData, PluginKey.key(pluginId), getWeeklyNotifs(sProvider, pluginId, setting.getUserId())); } } // boolean isDaily = context.value(NotificationJob.JOB_DAILY); if (isDaily) { for (String pluginId : setting.getDailyPlugins()) { putMap( notificationData, PluginKey.key(pluginId), getDailyNotifs(sProvider, context, pluginId, setting.getUserId())); } } } catch (Exception e) { LOG.error("Failed to get the NotificationMessage by user: " + setting.getUserId(), e); } finally { NotificationSessionManager.closeSessionProvider(created); } return notificationData; }