protected void addTrigger( SchedulerEntry schedulerEntry, ServiceReference<SchedulerEntry> serviceReference) { String propertyKey = schedulerEntry.getPropertyKey(); if (Validator.isNull(propertyKey)) { return; } long bundleId = GetterUtil.getLong(serviceReference.getProperty("bundle.id"), -1); String triggerValue = null; if (bundleId != 0) { Class<?> clazz = schedulerEntry.getClass(); ClassLoader classloader = clazz.getClassLoader(); triggerValue = getPluginPropertyValue(classloader, propertyKey); } else { triggerValue = PrefsPropsUtil.getString(propertyKey); } if (_log.isDebugEnabled()) { _log.debug("Scheduler property key " + propertyKey + " has trigger value " + triggerValue); } if (Validator.isNotNull(triggerValue)) { schedulerEntry.setTriggerValue(triggerValue); } }
private void _start() { if (_log.isDebugEnabled()) { _log.debug("Start"); } try { SchedulerEntry schedulerEntry = new SchedulerEntryImpl(); schedulerEntry.setEventListenerClass(POPNotificationsMessageListener.class.getName()); schedulerEntry.setTimeUnit(TimeUnit.MINUTE); schedulerEntry.setTriggerType(TriggerType.SIMPLE); schedulerEntry.setTriggerValue(PropsValues.POP_SERVER_NOTIFICATIONS_INTERVAL); SchedulerEngineUtil.schedule( schedulerEntry, StorageType.MEMORY_CLUSTERED, PortalClassLoaderUtil.getClassLoader(), 0); } catch (Exception e) { _log.error(e, e); } }