Java Code Examples for org.quartz.impl.matchers.GroupMatcher#groupEquals()

The following examples show how to use org.quartz.impl.matchers.GroupMatcher#groupEquals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Quartz2Adapter.java    From javamelody with Apache License 2.0 6 votes vote down vote up
@Override
List<JobDetail> getAllJobsOfScheduler(Scheduler scheduler) throws SchedulerException {
	final List<JobDetail> result = new ArrayList<JobDetail>();
	for (final String jobGroupName : scheduler.getJobGroupNames()) {
		final GroupMatcher<JobKey> groupMatcher = GroupMatcher.groupEquals(jobGroupName);
		for (final JobKey jobKey : scheduler.getJobKeys(groupMatcher)) {
			final JobDetail jobDetail;
			try {
				jobDetail = scheduler.getJobDetail(jobKey);
				// le job peut être terminé et supprimé depuis la ligne ci-dessus
				if (jobDetail != null) {
					result.add(jobDetail);
				}
			} catch (final Exception e) {
				// si les jobs sont persistés en base de données, il peut y avoir une exception
				// dans getJobDetail, par exemple si la classe du job n'existe plus dans l'application
				LOG.debug(e.toString(), e);
			}
		}
	}
	return result;
}
 
Example 2
Source File: AbstractQuartzTaskManager.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public AbstractQuartzTaskManager(TaskRepository taskRepository, TaskStore taskStore) throws TaskException {

        this.taskRepository = taskRepository;
        this.scheduler = TasksDSComponent.getScheduler();
        this.taskStore = taskStore;
        try {
            Matcher<TriggerKey> tenantTaskTypeGroupMatcher = GroupMatcher.groupEquals(this.getTenantTaskGroup());
            this.getScheduler().getListenerManager().addTriggerListener(
                    new TaskTriggerListener(this.getTenantTaskGroup()), tenantTaskTypeGroupMatcher);
        } catch (SchedulerException e) {
            throw new TaskException("Error in initiating task trigger listener", TaskException.Code.UNKNOWN, e);
        }
    }
 
Example 3
Source File: QuartzScheduler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>
 * Pause all of the <code>{@link Trigger}s</code> in the matching groups.
 * </p>
 *  
 */
public void pauseTriggers(GroupMatcher<TriggerKey> matcher)
    throws SchedulerException {
    validateState();

    if(matcher == null) {
        matcher = GroupMatcher.groupEquals(Scheduler.DEFAULT_GROUP);
    }

    Collection<String> pausedGroups = resources.getJobStore().pauseTriggers(matcher);
    notifySchedulerThread(0L);
    for (String pausedGroup : pausedGroups) {
        notifySchedulerListenersPausedTriggers(pausedGroup);
    }
}
 
Example 4
Source File: QuartzScheduler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>
 * Pause all of the <code>{@link org.quartz.JobDetail}s</code> in the
 * matching groups - by pausing all of their <code>Trigger</code>s.
 * </p>
 *  
 */
public void pauseJobs(GroupMatcher<JobKey> groupMatcher)
    throws SchedulerException {
    validateState();

    if(groupMatcher == null) {
        groupMatcher = GroupMatcher.groupEquals(Scheduler.DEFAULT_GROUP);
    }
    
    Collection<String> pausedGroups = resources.getJobStore().pauseJobs(groupMatcher);
    notifySchedulerThread(0L);
    for (String pausedGroup : pausedGroups) {
        notifySchedulerListenersPausedJobs(pausedGroup);
    }
}
 
Example 5
Source File: QuartzScheduler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>
 * Resume (un-pause) all of the <code>{@link Trigger}s</code> in the
 * matching groups.
 * </p>
 * 
 * <p>
 * If any <code>Trigger</code> missed one or more fire-times, then the
 * <code>Trigger</code>'s misfire instruction will be applied.
 * </p>
 *  
 */
public void resumeTriggers(GroupMatcher<TriggerKey> matcher)
    throws SchedulerException {
    validateState();

    if(matcher == null) {
        matcher = GroupMatcher.groupEquals(Scheduler.DEFAULT_GROUP);
    }

    Collection<String> pausedGroups = resources.getJobStore().resumeTriggers(matcher);
    notifySchedulerThread(0L);
    for (String pausedGroup : pausedGroups) {
        notifySchedulerListenersResumedTriggers(pausedGroup);
    }
}
 
Example 6
Source File: QuartzScheduler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>
 * Resume (un-pause) all of the <code>{@link org.quartz.JobDetail}s</code>
 * in the matching groups.
 * </p>
 * 
 * <p>
 * If any of the <code>Job</code> s had <code>Trigger</code> s that
 * missed one or more fire-times, then the <code>Trigger</code>'s
 * misfire instruction will be applied.
 * </p>
 *  
 */
public void resumeJobs(GroupMatcher<JobKey> matcher)
    throws SchedulerException {
    validateState();

    if(matcher == null) {
        matcher = GroupMatcher.groupEquals(Scheduler.DEFAULT_GROUP);
    }
    
    Collection<String> resumedGroups = resources.getJobStore().resumeJobs(matcher);
    notifySchedulerThread(0L);
    for (String pausedGroup : resumedGroups) {
        notifySchedulerListenersResumedJobs(pausedGroup);
    }
}
 
Example 7
Source File: QuartzScheduler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>
 * Get the names of all the <code>{@link org.quartz.Job}s</code> in the
 * matching groups.
 * </p>
 */
public Set<JobKey> getJobKeys(GroupMatcher<JobKey> matcher)
    throws SchedulerException {
    validateState();

    if(matcher == null) {
        matcher = GroupMatcher.groupEquals(Scheduler.DEFAULT_GROUP);
    }
    
    return resources.getJobStore().getJobKeys(matcher);
}
 
Example 8
Source File: QuartzScheduler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>
 * Get the names of all the <code>{@link org.quartz.Trigger}s</code> in
 * the matching groups.
 * </p>
 */
public Set<TriggerKey> getTriggerKeys(GroupMatcher<TriggerKey> matcher)
    throws SchedulerException {
    validateState();

    if(matcher == null) {
        matcher = GroupMatcher.groupEquals(Scheduler.DEFAULT_GROUP);
    }
    
    return resources.getJobStore().getTriggerKeys(matcher);
}
 
Example 9
Source File: AbstractQuartzTaskManager.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public AbstractQuartzTaskManager(TaskRepository taskRepository) throws TaskException {
    this.taskRepository = taskRepository;
    this.scheduler = TasksDSComponent.getScheduler();
    try {
        Matcher<TriggerKey> tenantTaskTypeGroupMatcher = GroupMatcher.groupEquals(this.getTenantTaskGroup());
        this.getScheduler().getListenerManager().addTriggerListener(
                new TaskTriggerListener(this.getTenantTaskGroup()), tenantTaskTypeGroupMatcher) ;
    } catch (SchedulerException e) {
        throw new TaskException("Error in initiating task trigger listener", Code.UNKNOWN, e);
    }
}