QuartzSchedulerEngine implements SchedulerEngine { protected void initJobState() throws Exception { List<String> groupNames = _persistedScheduler.getJobGroupNames(); for (String groupName : groupNames) { Set<JobKey> jobKeys = _persistedScheduler.getJobKeys( GroupMatcher.jobGroupEquals(groupName)); for (JobKey jobKey : jobKeys) { Trigger trigger = _persistedScheduler.getTrigger( new TriggerKey(jobKey.getName(), jobKey.getGroup())); if (trigger != null) { continue; } if (_schedulerEngineHelper != null) { JobDetail jobDetail = _persistedScheduler.getJobDetail( jobKey); _schedulerEngineHelper.auditSchedulerJobs( getMessage(jobDetail.getJobDataMap()), TriggerState.EXPIRED); } _persistedScheduler.deleteJob(jobKey); } } }  @Override void delete(String groupName, StorageType storageType); @Override void delete(
			String jobName, String groupName, StorageType storageType); int getDescriptionMaxLength(); int getGroupNameMaxLength(); int getJobNameMaxLength(); @Override SchedulerResponse getScheduledJob(
			String jobName, String groupName, StorageType storageType); @Override List<SchedulerResponse> getScheduledJobs(); @Override List<SchedulerResponse> getScheduledJobs(StorageType storageType); @Override List<SchedulerResponse> getScheduledJobs(
			String groupName, StorageType storageType); @Override void pause(String groupName, StorageType storageType); @Override void pause(String jobName, String groupName, StorageType storageType); @Override void resume(String groupName, StorageType storageType); @Override void resume(
			String jobName, String groupName, StorageType storageType); @Override void schedule(
			com.liferay.portal.kernel.scheduler.Trigger trigger,
			String description, String destination, Message message,
			StorageType storageType); @Override void shutdown(); @Override void start(); @Override void suppressError(
			String jobName, String groupName, StorageType storageType); @Override void unschedule(String groupName, StorageType storageType); @Override void unschedule(
			String jobName, String groupName, StorageType storageType); @Override void update(
			com.liferay.portal.kernel.scheduler.Trigger trigger,
			StorageType storageType); @Override void validateTrigger(
			com.liferay.portal.kernel.scheduler.Trigger trigger,
			StorageType storageType);  }
@Test public void testInitJobState() throws Exception { List<SchedulerResponse> schedulerResponses = _quartzSchedulerEngine.getScheduledJobs( _PERSISTED_TEST_GROUP_NAME, StorageType.PERSISTED); Assert.assertEquals( schedulerResponses.toString(), _DEFAULT_JOB_NUMBER, schedulerResponses.size()); MockScheduler mockScheduler = ReflectionTestUtil.getFieldValue( _quartzSchedulerEngine, "_persistedScheduler"); mockScheduler.addJob( _TEST_JOB_NAME_PREFIX + "persisted", _PERSISTED_TEST_GROUP_NAME, StorageType.PERSISTED, null); schedulerResponses = _quartzSchedulerEngine.getScheduledJobs( _PERSISTED_TEST_GROUP_NAME, StorageType.PERSISTED); Assert.assertEquals( schedulerResponses.toString(), _DEFAULT_JOB_NUMBER + 1, schedulerResponses.size()); _quartzSchedulerEngine.initJobState(); schedulerResponses = _quartzSchedulerEngine.getScheduledJobs( _PERSISTED_TEST_GROUP_NAME, StorageType.PERSISTED); Assert.assertEquals( schedulerResponses.toString(), _DEFAULT_JOB_NUMBER, schedulerResponses.size()); }