camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lakshmi Prashanth (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-7978) QuartzEndpoint should share the same camel context name when it working in cluster mode
Date Mon, 10 Nov 2014 07:58:34 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-7978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14204480#comment-14204480
] 

Lakshmi Prashanth commented on CAMEL-7978:
------------------------------------------

Hi,

  Can you also fix another issue with clustered quartz - when the quartz2 endpoints from 2
nodes try to create the job detail in DB, an ObjectAlreadyExists exception is thrown - leading
to misfires. Can we handle the above exception as below:

private void addJobInScheduler() throws Exception {
        // Add or use existing trigger to/from scheduler
        Scheduler scheduler = getComponent().getScheduler();
        JobDetail jobDetail;
        Trigger trigger = scheduler.getTrigger(triggerKey);
        if (trigger == null) {
            jobDetail = createJobDetail();
            trigger = createTrigger(jobDetail);

            updateJobDataMap(jobDetail);

            // Schedule it now. Remember that scheduler might not be started it, but we can
schedule now.
            try{
	            Date nextFireDate = scheduler.scheduleJob(jobDetail, trigger);
	            if (LOG.isInfoEnabled()) {
	                LOG.info("Job {} (triggerType={}, jobClass={}) is scheduled. Next fire date
is {}",
	                         new Object[] {trigger.getKey(), trigger.getClass().getSimpleName(),
	                                       jobDetail.getJobClass().getSimpleName(), nextFireDate});
	            }
            }
            catch(ObjectAlreadyExistsException e){
            	//some other VM might may have stored the job & trigger in DB in clustered
mode, in the mean time
            	if(!(getComponent().isClustered())){            		
            		throw e;
            	}
             }
        } else {
            ensureNoDupTriggerKey();
        }

        // Increase camel job count for this endpoint
        AtomicInteger number = (AtomicInteger) scheduler.getContext().get(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT);
        if (number != null) {
            number.incrementAndGet();
        }

        jobAdded.set(true);
    }


Thanks,
Lakshmi

> QuartzEndpoint should share the same camel context name when it working in cluster mode
> ---------------------------------------------------------------------------------------
>
>                 Key: CAMEL-7978
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7978
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-quartz, camel-quartz2
>    Affects Versions: 2.13.2, 2.14.0
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 2.14.1, 2.15.0, 2.13.4
>
>
> It could cause some trouble[1] when two cluster camel-quartz endpoints are share different
camel context name.
> [1]http://camel.465427.n5.nabble.com/Quartz-job-data-deletion-in-clustered-quartz2-tp5757508.html




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message