Package org.quartz

Examples of org.quartz.Job


    }

    public void registerJob(final Task task, final String jobClassName, final String cronExpression) throws Exception {

        Class jobClass = Class.forName(jobClassName);
        Job jobInstance = (Job) getBeanFactory().createBean(jobClass, AbstractBeanDefinition.AUTOWIRE_BY_TYPE, false);
        if (jobInstance instanceof AbstractTaskJob) {
            ((AbstractTaskJob) jobInstance).setTaskId(task.getId());
        }
        if (jobInstance instanceof SyncJob && task instanceof SyncTask) {
            String jobActionsClassName = ((SyncTask) task).getJobActionsClassName();
View Full Code Here


        registerJob(getJobName(task), jobInstance, cronExpression);
    }

    public void registerJob(final Report report) throws Exception {

        Job jobInstance = (Job) getBeanFactory().createBean(ReportJob.class, AbstractBeanDefinition.AUTOWIRE_BY_TYPE,
                false);
        ((ReportJob) jobInstance).setReportId(report.getId());

        registerJob(getJobName(report), jobInstance, report.getCronExpression());
    }
View Full Code Here

                final JobDetail detail = createJobDetail(name, jobDataMap);

                TriggerFiredBundle trigger = new TriggerFiredBundle(detail, null, null, false, null, null, null, null);

                final Job executor = createJobExecutor();
                final JobExecutionContext context = new JobExecutionContext(this.scheduler, trigger, executor);

                this.executor.execute(new Runnable() {
                        public void run() {
                            // ((CronJob)job).execute(name);
                            try {
                                executor.execute(context);
                            } catch (JobExecutionException e) {
                                getLogger().error("Job '" + job + "' died.", e);
                            }
                        }
                    });
View Full Code Here

                final Trigger trigger = new SimpleTrigger(name, DEFAULT_QUARTZ_JOB_GROUP);

                TriggerFiredBundle fireBundle = new TriggerFiredBundle(detail, trigger, null, false, null, null, null, null);

                final Job executor = createJobExecutor();
                final JobExecutionContext context = new JobExecutionContext(this.scheduler, fireBundle, executor);

                this.executor.execute(new Runnable() {
                        public void run() {
                            try {
                                executor.execute(context);
                            } catch (JobExecutionException e) {
                                getLogger().error("Job '" + job + "' died.", e);
                            }
                        }
                    });
View Full Code Here

            {
                jobDataMap.put(QuartzConnector.PROPERTY_PAYLOAD, ((EventGeneratorJobConfig) jobConfig).getPayload());
            }
            jobDataMap.put(QuartzConnector.PROPERTY_JOB_CONFIG, jobConfig);

            Job job = null;
            if (jobConfig instanceof CustomJobConfig)
            {
                job = ((CustomJobConfig) jobConfig).getJob();
            }
            // If there has been a job created or found then we default to a custom Job configuration
View Full Code Here

            jobDataMap.put("endpointRef", endpointRef);
        }
        jobDetail.setJobDataMap(jobDataMap);

        Job job = null;
        // work out what we're actually calling
        Object payload = event.getMessage().getPayload();

        if(jobConfig instanceof CustomJobConfig)
        {
View Full Code Here

      {
         List jobs = getAllExcutingJobs();
         for (Object object : jobs)
         {
            JobExecutionContext ctx = (JobExecutionContext)object;
            Job job = ctx.getJobInstance();
            if (job instanceof InterruptableJob)
            {
               ((InterruptableJob)job).interrupt();
            }
         }
View Full Code Here

            final JobSpec spec = (JobSpec) activationSpec;

            final MessageEndpoint endpoint = messageEndpointFactory.createEndpoint(null);
            spec.setEndpoint(endpoint);

            final Job job = (Job) endpoint;

            final JobDataMap jobDataMap = spec.getDetail().getJobDataMap();
            jobDataMap.put(Data.class.getName(), new Data(job));

            s.scheduleJob(spec.getDetail(), spec.getTrigger());
View Full Code Here

                final JobDataMap jobDataMap = execution.getJobDetail().getJobDataMap();

                final Data data = Data.class.cast(jobDataMap.get(Data.class.getName()));

                final Job job = data.job;

                if (null == method) {
                    method = job.getClass().getMethod("execute", JobExecutionContext.class);
                }

                endpoint = (MessageEndpoint) job;
                endpoint.beforeDelivery(method);

                job.execute(execution);

            } catch (NoSuchMethodException e) {
                throw new IllegalStateException(e);
            } catch (ResourceException e) {
                ex = new JobExecutionException(e);
View Full Code Here

        List jobs = getCurrentlyExecutingJobs();
        java.util.Iterator it = jobs.iterator();
       
        JobExecutionContext jec = null;
        JobDetail jobDetail = null;
        Job job = null;
       
        boolean interrupted = false;
       
        while (it.hasNext()) {
            jec = (JobExecutionContext)it.next();
View Full Code Here

TOP

Related Classes of org.quartz.Job

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.