Package org.quartz

Examples of org.quartz.TriggerKey


        String triggerName = JobInstanceLoader.getTriggerName(JobInstanceLoader.getJobName(report));

        Trigger trigger;
        try {
            trigger = scheduler.getScheduler().getTrigger(new TriggerKey(triggerName, Scheduler.DEFAULT_GROUP));
        } catch (SchedulerException e) {
            LOG.warn("While trying to get to " + triggerName, e);
            trigger = null;
        }
View Full Code Here


    private void setExecTime(final SchedTaskTO taskTO, final Task task) {
        String triggerName = JobInstanceLoader.getTriggerName(JobInstanceLoader.getJobName(task));

        Trigger trigger = null;
        try {
            trigger = scheduler.getScheduler().getTrigger(new TriggerKey(triggerName, Scheduler.DEFAULT_GROUP));
        } catch (SchedulerException e) {
            LOG.warn("While trying to get to " + triggerName, e);
        }

        if (trigger != null) {
View Full Code Here

        camel1.start();

        QuartzComponent component = (QuartzComponent) camel1.getComponent("quartz2");
        Scheduler scheduler = component.getScheduler();
        TriggerKey triggerKey = TriggerKey.triggerKey("myTimerName", "myGroup");
        Trigger trigger = scheduler.getTrigger(triggerKey);
        Assert.assertNotNull(trigger);

        camel1.stopRoute("route-1");
View Full Code Here

    private void ensureNoDupTriggerKey() {
        for (Route route : getCamelContext().getRoutes()) {
            if (route.getEndpoint() instanceof QuartzEndpoint) {
                QuartzEndpoint quartzEndpoint = (QuartzEndpoint) route.getEndpoint();
                TriggerKey checkTriggerKey = quartzEndpoint.getTriggerKey();
                if (triggerKey.equals(checkTriggerKey)) {
                    throw new IllegalArgumentException("Trigger key " + triggerKey + " is already in use by " + quartzEndpoint);
                }
            }
        }
View Full Code Here

            throw new JobExecutionException("Failed to obtain scheduler context for job " + context.getJobDetail().getKey());
        }
    }

    protected QuartzEndpoint lookupQuartzEndpoint(CamelContext camelContext, JobExecutionContext quartzContext) throws JobExecutionException {
        TriggerKey triggerKey = quartzContext.getTrigger().getKey();
        if (LOG.isDebugEnabled()) {
            LOG.debug("Looking up existing QuartzEndpoint with triggerKey={}", triggerKey);
        }

        // check all active routes for the quartz endpoint this task matches
        // as we prefer to use the existing endpoint from the routes
        for (Route route : camelContext.getRoutes()) {
            Endpoint endpoint = route.getEndpoint();
            if (endpoint instanceof DelegateEndpoint) {
                endpoint = ((DelegateEndpoint)endpoint).getEndpoint();  
            }
            if (endpoint instanceof QuartzEndpoint) {
                QuartzEndpoint quartzEndpoint = (QuartzEndpoint) endpoint;
                TriggerKey checkTriggerKey = quartzEndpoint.getTriggerKey();
                if (LOG.isTraceEnabled()) {
                    LOG.trace("Checking route endpoint={} with checkTriggerKey={}", quartzEndpoint, checkTriggerKey);
                }
                if (triggerKey.equals(checkTriggerKey)) {
                    return quartzEndpoint;
View Full Code Here

    public void testEnabledJobCreation() throws Exception {
        quartzManagementService.enableScheduler();

        final long jobId = 1234;
        JobKey jobKey = QzerverKeyUtils.jobKey(jobId);
        TriggerKey triggerKey = QzerverKeyUtils.triggerKey(jobId);

        String jobCron = composeCronExpression(DEFAULT_SCHEDULE_ADVANCE_MS);
        quartzManagementService.createJob(jobId, jobCron, GLOBAL_TIMEZONE, true);

        List<String> jobGroups = scheduler.getJobGroupNames();
View Full Code Here

    public void testToggleJob() throws Exception {
        quartzManagementService.enableScheduler();

        final long jobId = 1234;
        JobKey jobKey = QzerverKeyUtils.jobKey(jobId);
        TriggerKey triggerKey = QzerverKeyUtils.triggerKey(jobId);

        String jobCron = composeCronExpression(DEFAULT_SCHEDULE_ADVANCE_MS);
        quartzManagementService.createJob(jobId, jobCron, GLOBAL_TIMEZONE, true);
        Assert.assertTrue(quartzManagementService.isJobActive(jobId));
View Full Code Here

    public void testRescheduleJob() throws Exception {
        quartzManagementService.enableScheduler();

        final long jobId = 1234;
        JobKey jobKey = QzerverKeyUtils.jobKey(jobId);
        TriggerKey triggerKey = QzerverKeyUtils.triggerKey(jobId);

        String jobCron = composeCronExpression(DEFAULT_SCHEDULE_ADVANCE_MS);
        quartzManagementService.createJob(jobId, jobCron, GLOBAL_TIMEZONE, true);

        String jobRescheduledCron = composeCronExpression(DEFAULT_SCHEDULE_ADVANCE_MS + 10);
View Full Code Here

   
    public Trigger getTrigger() {
       
        if (scheduler != null) {
            try {
                final TriggerKey key = new TriggerKey(trigger.getName(), trigger.getGroup());
                if (scheduler.checkExists(key)) {
                    return scheduler.getTrigger(key);
                }
            } catch (SchedulerException e) {
                return null;
View Full Code Here

    private void ensureNoDupTriggerKey() {
        for (Route route : getCamelContext().getRoutes()) {
            if (route.getEndpoint() instanceof QuartzEndpoint) {
                QuartzEndpoint quartzEndpoint = (QuartzEndpoint) route.getEndpoint();
                TriggerKey checkTriggerKey = quartzEndpoint.getTriggerKey();
                if (triggerKey.equals(checkTriggerKey)) {
                    throw new IllegalArgumentException("Trigger key " + triggerKey + " is already in used by " + quartzEndpoint);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.quartz.TriggerKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.