001
014
015 package com.liferay.portal.kernel.scheduler.config;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.scheduler.SchedulerEngineHelperUtil;
020 import com.liferay.portal.kernel.scheduler.SchedulerEntry;
021 import com.liferay.portal.kernel.util.BasePortalLifecycle;
022 import com.liferay.portal.kernel.util.PortalLifecycle;
023
024
028 public class DefaultSchedulingConfigurator
029 extends AbstractSchedulingConfigurator {
030
031 public void configure() {
032 if (schedulerEntries.isEmpty()) {
033 return;
034 }
035
036 SchedulingConfiguratorLifecycle schedulingConfiguratorLifecycle =
037 new SchedulingConfiguratorLifecycle();
038
039 schedulingConfiguratorLifecycle.registerPortalLifecycle(
040 PortalLifecycle.METHOD_INIT);
041 }
042
043 private static Log _log = LogFactoryUtil.getLog(
044 DefaultSchedulingConfigurator.class);
045
046 private class SchedulingConfiguratorLifecycle extends BasePortalLifecycle {
047
048 @Override
049 protected void doPortalDestroy() throws Exception {
050 }
051
052 @Override
053 protected void doPortalInit() throws Exception {
054 for (SchedulerEntry schedulerEntry : schedulerEntries) {
055 try {
056 SchedulerEngineHelperUtil.schedule(
057 schedulerEntry, storageType, null, exceptionsMaxSize);
058 }
059 catch (Exception e) {
060 _log.error("Unable to schedule " + schedulerEntry, e);
061 }
062 }
063 }
064
065 }
066
067 }