Package org.apache.deltaspike.scheduler.api

Examples of org.apache.deltaspike.scheduler.api.Scheduled


    {
        JobKey jobKey = createJobKey(jobClass);

        try
        {
            Scheduled scheduled = jobClass.getAnnotation(Scheduled.class);

            String description = scheduled.description();

            if ("".equals(scheduled.description()))
            {
                description = jobClass.getName();
            }

            JobDetail jobDetail = JobBuilder.newJob(jobClass)
                    .withDescription(description)
                    .withIdentity(jobKey)
                    .build();
            Trigger trigger = TriggerBuilder.newTrigger()
                    .withSchedule(CronScheduleBuilder.cronSchedule(scheduled.cronExpression()))
                    .build();

            this.scheduler.scheduleJob(jobDetail, trigger);
        }
        catch (SchedulerException e)
View Full Code Here


        }
    }

    private static JobKey createJobKey(Class<?> jobClass)
    {
        Scheduled scheduled = jobClass.getAnnotation(Scheduled.class);

        if (scheduled == null)
        {
            throw new IllegalStateException("@" + Scheduled.class.getName() + " is missing on " + jobClass.getName());
        }

        String groupName = scheduled.group().getSimpleName();
        String jobName = jobClass.getSimpleName();

        if (!Scheduled.class.getSimpleName().equals(groupName))
        {
            return new JobKey(jobName, groupName);
View Full Code Here

        }

        @Override
        public void jobToBeExecuted(JobExecutionContext jobExecutionContext)
        {
            Scheduled scheduled = jobExecutionContext.getJobInstance().getClass().getAnnotation(Scheduled.class);

            Collections.addAll(this.scopes, scheduled.startScopes());

            if (!this.scopes.isEmpty())
            {
                this.contextControl = BeanProvider.getContextualReference(ContextControl.class);
View Full Code Here

TOP

Related Classes of org.apache.deltaspike.scheduler.api.Scheduled

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.