Package org.rhq.enterprise.server.scheduler

Examples of org.rhq.enterprise.server.scheduler.EnhancedScheduler


    public void unschedulePluginJobs(PluginKey pluginKey) throws Exception {

        // note: all jobs for a plugin are placed in the same group, where the group name is the plugin name
        String groupName = pluginKey.getPluginName();

        EnhancedScheduler clusteredScheduler = getMasterServerPluginContainer().getClusteredScheduler();
        EnhancedScheduler nonclusteredScheduler = getMasterServerPluginContainer().getNonClusteredScheduler();

        for (Scheduler scheduler : new Scheduler[] { clusteredScheduler, nonclusteredScheduler }) {
            String[] jobNames = scheduler.getJobNames(groupName);
            if (jobNames != null) {
                for (String jobName : jobNames) {
View Full Code Here


        if (schedule.getCallbackData() != null) {
            jobData.putAll(schedule.getCallbackData());
        }

        // schedule the job now
        EnhancedScheduler scheduler;

        if (schedule.getScheduleType().isClustered()) {
            scheduler = getMasterServerPluginContainer().getClusteredScheduler();
        } else {
            scheduler = getMasterServerPluginContainer().getNonClusteredScheduler();
        }

        if (schedule.getScheduleType() instanceof CronScheduleType) {
            String cronExpression = ((CronScheduleType) schedule.getScheduleType()).getCronExpression();
            log.info("Scheduling server plugin cron job: jobName=" + schedule.getJobId() + ", groupName=" + groupName
                + ", jobClass=" + jobClass + ", cron=" + cronExpression);
            scheduler.scheduleCronJob(schedule.getJobId(), groupName, jobData, jobClass, rescheduleIfExists,
                isVolatile, cronExpression);
        } else {
            long initialDelay = 10000L; // arbitrary - wait a small bit of time before triggering the job
            long interval = ((PeriodicScheduleType) schedule.getScheduleType()).getPeriod();
            log.info("Scheduling server plugin periodic job: jobName=" + schedule.getJobId() + ", groupName="
                + groupName + ", jobClass=" + jobClass + ", interval=" + interval);
            scheduler.scheduleRepeatingJob(schedule.getJobId(), groupName, jobData, jobClass, rescheduleIfExists,
                isVolatile, initialDelay, interval);
        }

        return;
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.scheduler.EnhancedScheduler

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.