📄 driverdelegate.java
字号:
/* * Copyright James House (c) 2001-2004 * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: 1. * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. 2. Redistributions in * binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */package org.quartz.impl.jdbcjobstore;import java.io.IOException;import java.sql.Connection;import java.sql.SQLException;import java.util.List;import java.util.Set;import org.quartz.Calendar;import org.quartz.CronTrigger;import org.quartz.JobDetail;import org.quartz.SimpleTrigger;import org.quartz.Trigger;import org.quartz.spi.ClassLoadHelper;import org.quartz.utils.Key;import org.quartz.utils.TriggerStatus;/** * <p> * This is the base interface for all driver delegate classes. * </p> * * <p> * This interface is very similar to the <code>{@link * org.quartz.spi.JobStore}</code> * interface except each method has an additional <code>{@link java.sql.Connection}</code> * parameter. * </p> * * <p> * Unless a database driver has some <strong>extremely-DB-specific</strong> * requirements, any DriverDelegate implementation classes should extend the * <code>{@link org.quartz.impl.jdbcjobstore.StdJDBCDelegate}</code> class. * </p> * * @author <a href="mailto:jeff@binaryfeed.org">Jeffrey Wescott</a> * @author James House */public interface DriverDelegate { /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Interface. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ //--------------------------------------------------------------------------- // startup / recovery //--------------------------------------------------------------------------- /** * <p> * Update all triggers having one of the two given states, to the given new * state. * </p> * * @param conn * the DB Connection * @param newState * the new state for the triggers * @param oldState1 * the first old state to update * @param oldState2 * the second old state to update * @return number of rows updated */ public int updateTriggerStatesFromOtherStates(Connection conn, String newState, String oldState1, String oldState2) throws SQLException; /** * <p> * Get the names of all of the triggers that have misfired - according to * the given timestamp. * </p> * * @param conn * the DB Connection * @return an array of <code>{@link * org.quartz.utils.Key}</code> objects */ public Key[] selectMisfiredTriggers(Connection conn, long ts) throws SQLException; /** * <p> * Get the names of all of the triggers in the given state that have * misfired - according to the given timestamp. * </p> * * @param conn * the DB Connection * @return an array of <code>{@link * org.quartz.utils.Key}</code> objects */ public Key[] selectMisfiredTriggersInState(Connection conn, String state, long ts) throws SQLException; /** * <p> * Get the names of all of the triggers in the given group and state that * have misfired - according to the given timestamp. * </p> * * @param conn * the DB Connection * @return an array of <code>{@link * org.quartz.utils.Key}</code> objects */ public Key[] selectMisfiredTriggersInGroupInState(Connection conn, String groupName, String state, long ts) throws SQLException; /** * <p> * Select all of the triggers for jobs that are requesting recovery. The * returned trigger objects will have unique "recoverXXX" trigger names and * will be in the <code>{@link * org.quartz.Scheduler}.DEFAULT_RECOVERY_GROUP</code> * trigger group. * </p> * * <p> * In order to preserve the ordering of the triggers, the fire time will be * set from the <code>COL_FIRED_TIME</code> column in the <code>TABLE_FIRED_TRIGGERS</code> * table. The caller is responsible for calling <code>computeFirstFireTime</code> * on each returned trigger. It is also up to the caller to insert the * returned triggers to ensure that they are fired. * </p> * * @param conn * the DB Connection * @return an array of <code>{@link org.quartz.Trigger}</code> objects */ public Trigger[] selectTriggersForRecoveringJobs(Connection conn) throws SQLException; /** * <p> * Delete all fired triggers. * </p> * * @param conn * the DB Connection * @return the number of rows deleted */ public int deleteFiredTriggers(Connection conn) throws SQLException; /** * <p> * Delete all fired triggers of the given instance. * </p> * * @param conn * the DB Connection * @return the number of rows deleted */ public int deleteFiredTriggers(Connection conn, String instanceId) throws SQLException; /** * <p> * Delete all volatile fired triggers. * </p> * * @param conn * the DB Connection * @return the number of rows deleted */ public int deleteVolatileFiredTriggers(Connection conn) throws SQLException; /** * <p> * Get the names of all of the triggers that are volatile. * </p> * * @param conn * the DB Connection * @return an array of <code>{@link * org.quartz.utils.Key}</code> objects */ public Key[] selectVolatileTriggers(Connection conn) throws SQLException; /** * <p> * Get the names of all of the jobs that are volatile. * </p> * * @param conn * the DB Connection * @return an array of <code>{@link * org.quartz.utils.Key}</code> objects */ public Key[] selectVolatileJobs(Connection conn) throws SQLException; //--------------------------------------------------------------------------- // jobs //--------------------------------------------------------------------------- /** * <p> * Insert the job detail record. * </p> * * @param conn * the DB Connection * @param job * the job to insert * @return number of rows inserted * @throws IOException * if there were problems serializing the JobDataMap */ public int insertJobDetail(Connection conn, JobDetail job) throws IOException, SQLException; /** * <p> * Update the job detail record. * </p> * * @param conn * the DB Connection * @param job * the job to update * @return number of rows updated * @throws IOException * if there were problems serializing the JobDataMap */ public int updateJobDetail(Connection conn, JobDetail job) throws IOException, SQLException; /** * <p> * Get the names of all of the triggers associated with the given job. * </p> * * @param conn * the DB Connection * @param jobName * the job name * @param groupName * the job group * @return an array of <code>{@link * org.quartz.utils.Key}</code> objects */ public Key[] selectTriggerNamesForJob(Connection conn, String jobName, String groupName) throws SQLException; /** * <p> * Delete all job listeners for the given job. * </p> * * @param conn * the DB Connection * @param jobName * the name of the job * @param groupName * the group containing the job * @return the number of rows deleted */ public int deleteJobListeners(Connection conn, String jobName, String groupName) throws SQLException; /** * <p> * Delete the job detail record for the given job. * </p> * * @param conn * the DB Connection * @param jobName * the name of the job * @param groupName * the group containing the job * @return the number of rows deleted */ public int deleteJobDetail(Connection conn, String jobName, String groupName) throws SQLException; /** * <p> * Check whether or not the given job is stateful. * </p> * * @param conn * the DB Connection * @param jobName * the name of the job * @param groupName * the group containing the job * @return true if the job exists and is stateful, false otherwise */ public boolean isJobStateful(Connection conn, String jobName, String groupName) throws SQLException; /** * <p> * Check whether or not the given job exists. * </p> * * @param conn * the DB Connection * @param jobName * the name of the job * @param groupName * the group containing the job * @return true if the job exists, false otherwise */ public boolean jobExists(Connection conn, String jobName, String groupName) throws SQLException; /** * <p> * Update the job data map for the given job. * </p> * * @param conn * the DB Connection * @param job * the job to update * @return the number of rows updated * @throws IOException * if there were problems serializing the JobDataMap */ public int updateJobData(Connection conn, JobDetail job) throws IOException, SQLException; /** * <p> * Associate a listener with a job. * </p> * * @param conn * the DB Connection * @param job * the job to associate with the listener * @param listener * the listener to insert * @return the number of rows inserted */ public int insertJobListener(Connection conn, JobDetail job, String listener) throws SQLException; /** * <p> * Get all of the listeners for a given job. * </p> * * @param conn * the DB Connection * @param jobName * the job name whose listeners are wanted * @param groupName * the group containing the job * @return array of <code>String</code> listener names */ public String[] selectJobListeners(Connection conn, String jobName, String groupName) throws SQLException; /** * <p> * Select the JobDetail object for a given job name / group name. * </p> * * @param conn * the DB Connection * @param jobName * the job name whose listeners are wanted * @param groupName * the group containing the job * @return the populated JobDetail object * @throws ClassNotFoundException * if a class found during deserialization cannot be found or if * the job class could not be found * @throws IOException * if deserialization causes an error */ public JobDetail selectJobDetail(Connection conn, String jobName, String groupName, ClassLoadHelper loadHelper) throws ClassNotFoundException, IOException, SQLException; /** * <p> * Select the total number of jobs stored. * </p> * * @param conn * the DB Connection * @return the total number of jobs stored */ public int selectNumJobs(Connection conn) throws SQLException; /** * <p> * Select all of the job group names that are stored. * </p> * * @param conn * the DB Connection * @return an array of <code>String</code> group names */ public String[] selectJobGroups(Connection conn) throws SQLException; /** * <p> * Select all of the jobs contained in a given group. * </p> * * @param conn * the DB Connection * @param groupName * the group containing the jobs * @return an array of <code>String</code> job names */ public String[] selectJobsInGroup(Connection conn, String groupName) throws SQLException; //--------------------------------------------------------------------------- // triggers //--------------------------------------------------------------------------- /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -