All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.logspace.jvm.agent.shaded.quartz.impl.StdScheduler Maven / Gradle / Ivy

The newest version!
/* 
 * Copyright 2001-2009 Terracotta, Inc. 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 * use this file except in compliance with the License. You may obtain a copy 
 * of the License at 
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0 
 *   
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
 * License for the specific language governing permissions and limitations 
 * under the License.
 * 
 */

package io.logspace.jvm.agent.shaded.quartz.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

import io.logspace.jvm.agent.shaded.quartz.Calendar;
import io.logspace.jvm.agent.shaded.quartz.JobDataMap;
import io.logspace.jvm.agent.shaded.quartz.JobDetail;
import io.logspace.jvm.agent.shaded.quartz.JobExecutionContext;
import io.logspace.jvm.agent.shaded.quartz.JobKey;
import io.logspace.jvm.agent.shaded.quartz.ListenerManager;
import io.logspace.jvm.agent.shaded.quartz.Scheduler;
import io.logspace.jvm.agent.shaded.quartz.SchedulerContext;
import io.logspace.jvm.agent.shaded.quartz.SchedulerException;
import io.logspace.jvm.agent.shaded.quartz.SchedulerMetaData;
import io.logspace.jvm.agent.shaded.quartz.Trigger;
import io.logspace.jvm.agent.shaded.quartz.TriggerKey;
import io.logspace.jvm.agent.shaded.quartz.UnableToInterruptJobException;
import io.logspace.jvm.agent.shaded.quartz.Trigger.TriggerState;
import io.logspace.jvm.agent.shaded.quartz.core.QuartzScheduler;
import io.logspace.jvm.agent.shaded.quartz.impl.matchers.GroupMatcher;
import io.logspace.jvm.agent.shaded.quartz.spi.JobFactory;

/**
 * 

* An implementation of the Scheduler interface that directly * proxies all method calls to the equivalent call on a given QuartzScheduler * instance. *

* * @see io.logspace.jvm.agent.shaded.quartz.Scheduler * @see io.logspace.jvm.agent.shaded.quartz.core.QuartzScheduler * * @author James House */ public class StdScheduler implements Scheduler { /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Data members. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ private QuartzScheduler sched; /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Constructors. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /** *

* Construct a StdScheduler instance to proxy the given * QuartzScheduler instance, and with the given SchedulingContext. *

*/ public StdScheduler(QuartzScheduler sched) { this.sched = sched; } /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Interface. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /** *

* Returns the name of the Scheduler. *

*/ public String getSchedulerName() { return sched.getSchedulerName(); } /** *

* Returns the instance Id of the Scheduler. *

*/ public String getSchedulerInstanceId() { return sched.getSchedulerInstanceId(); } public SchedulerMetaData getMetaData() { return new SchedulerMetaData(getSchedulerName(), getSchedulerInstanceId(), getClass(), false, isStarted(), isInStandbyMode(), isShutdown(), sched.runningSince(), sched.numJobsExecuted(), sched.getJobStoreClass(), sched.supportsPersistence(), sched.isClustered(), sched.getThreadPoolClass(), sched.getThreadPoolSize(), sched.getVersion()); } /** *

* Returns the SchedulerContext of the Scheduler. *

*/ public SchedulerContext getContext() throws SchedulerException { return sched.getSchedulerContext(); } /////////////////////////////////////////////////////////////////////////// /// /// Schedululer State Management Methods /// /////////////////////////////////////////////////////////////////////////// /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void start() throws SchedulerException { sched.start(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void startDelayed(int seconds) throws SchedulerException { sched.startDelayed(seconds); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void standby() { sched.standby(); } /** * Whether the scheduler has been started. * *

* Note: This only reflects whether {@link #start()} has ever * been called on this Scheduler, so it will return true even * if the Scheduler is currently in standby mode or has been * since shutdown. *

* * @see #start() * @see #isShutdown() * @see #isInStandbyMode() */ public boolean isStarted() { return (sched.runningSince() != null); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean isInStandbyMode() { return sched.isInStandbyMode(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void shutdown() { sched.shutdown(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void shutdown(boolean waitForJobsToComplete) { sched.shutdown(waitForJobsToComplete); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean isShutdown() { return sched.isShutdown(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public List getCurrentlyExecutingJobs() { return sched.getCurrentlyExecutingJobs(); } /////////////////////////////////////////////////////////////////////////// /// /// Scheduling-related Methods /// /////////////////////////////////////////////////////////////////////////// /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void clear() throws SchedulerException { sched.clear(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public Date scheduleJob(JobDetail jobDetail, Trigger trigger) throws SchedulerException { return sched.scheduleJob(jobDetail, trigger); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public Date scheduleJob(Trigger trigger) throws SchedulerException { return sched.scheduleJob(trigger); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void addJob(JobDetail jobDetail, boolean replace) throws SchedulerException { sched.addJob(jobDetail, replace); } public void addJob(JobDetail jobDetail, boolean replace, boolean storeNonDurableWhileAwaitingScheduling) throws SchedulerException { sched.addJob(jobDetail, replace, storeNonDurableWhileAwaitingScheduling); } public boolean deleteJobs(List jobKeys) throws SchedulerException { return sched.deleteJobs(jobKeys); } public void scheduleJobs(Map> triggersAndJobs, boolean replace) throws SchedulerException { sched.scheduleJobs(triggersAndJobs, replace); } public void scheduleJob(JobDetail jobDetail, Set triggersForJob, boolean replace) throws SchedulerException { sched.scheduleJob(jobDetail, triggersForJob, replace); } public boolean unscheduleJobs(List triggerKeys) throws SchedulerException { return sched.unscheduleJobs(triggerKeys); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean deleteJob(JobKey jobKey) throws SchedulerException { return sched.deleteJob(jobKey); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean unscheduleJob(TriggerKey triggerKey) throws SchedulerException { return sched.unscheduleJob(triggerKey); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public Date rescheduleJob(TriggerKey triggerKey, Trigger newTrigger) throws SchedulerException { return sched.rescheduleJob(triggerKey, newTrigger); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void triggerJob(JobKey jobKey) throws SchedulerException { triggerJob(jobKey, null); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void triggerJob(JobKey jobKey, JobDataMap data) throws SchedulerException { sched.triggerJob(jobKey, data); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void pauseTrigger(TriggerKey triggerKey) throws SchedulerException { sched.pauseTrigger(triggerKey); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void pauseTriggers(GroupMatcher matcher) throws SchedulerException { sched.pauseTriggers(matcher); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void pauseJob(JobKey jobKey) throws SchedulerException { sched.pauseJob(jobKey); } /** * @see io.logspace.jvm.agent.shaded.quartz.Scheduler#getPausedTriggerGroups() */ public Set getPausedTriggerGroups() throws SchedulerException { return sched.getPausedTriggerGroups(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void pauseJobs(GroupMatcher matcher) throws SchedulerException { sched.pauseJobs(matcher); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void resumeTrigger(TriggerKey triggerKey) throws SchedulerException { sched.resumeTrigger(triggerKey); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void resumeTriggers(GroupMatcher matcher) throws SchedulerException { sched.resumeTriggers(matcher); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void resumeJob(JobKey jobKey) throws SchedulerException { sched.resumeJob(jobKey); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void resumeJobs(GroupMatcher matcher) throws SchedulerException { sched.resumeJobs(matcher); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void pauseAll() throws SchedulerException { sched.pauseAll(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void resumeAll() throws SchedulerException { sched.resumeAll(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public List getJobGroupNames() throws SchedulerException { return sched.getJobGroupNames(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public List getTriggersOfJob(JobKey jobKey) throws SchedulerException { return sched.getTriggersOfJob(jobKey); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public Set getJobKeys(GroupMatcher matcher) throws SchedulerException { return sched.getJobKeys(matcher); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public List getTriggerGroupNames() throws SchedulerException { return sched.getTriggerGroupNames(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public Set getTriggerKeys(GroupMatcher matcher) throws SchedulerException { return sched.getTriggerKeys(matcher); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public JobDetail getJobDetail(JobKey jobKey) throws SchedulerException { return sched.getJobDetail(jobKey); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public Trigger getTrigger(TriggerKey triggerKey) throws SchedulerException { return sched.getTrigger(triggerKey); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public TriggerState getTriggerState(TriggerKey triggerKey) throws SchedulerException { return sched.getTriggerState(triggerKey); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void addCalendar(String calName, Calendar calendar, boolean replace, boolean updateTriggers) throws SchedulerException { sched.addCalendar(calName, calendar, replace, updateTriggers); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean deleteCalendar(String calName) throws SchedulerException { return sched.deleteCalendar(calName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public Calendar getCalendar(String calName) throws SchedulerException { return sched.getCalendar(calName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public List getCalendarNames() throws SchedulerException { return sched.getCalendarNames(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean checkExists(JobKey jobKey) throws SchedulerException { return sched.checkExists(jobKey); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean checkExists(TriggerKey triggerKey) throws SchedulerException { return sched.checkExists(triggerKey); } /////////////////////////////////////////////////////////////////////////// /// /// Other Methods /// /////////////////////////////////////////////////////////////////////////// /** * @see io.logspace.jvm.agent.shaded.quartz.Scheduler#setJobFactory(io.logspace.jvm.agent.shaded.quartz.spi.JobFactory) */ public void setJobFactory(JobFactory factory) throws SchedulerException { sched.setJobFactory(factory); } /** * @see io.logspace.jvm.agent.shaded.quartz.Scheduler#getListenerManager() */ public ListenerManager getListenerManager() throws SchedulerException { return sched.getListenerManager(); } public boolean interrupt(JobKey jobKey) throws UnableToInterruptJobException { return sched.interrupt(jobKey); } public boolean interrupt(String fireInstanceId) throws UnableToInterruptJobException { return sched.interrupt(fireInstanceId); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy