日期:2014-05-17  浏览次数:20767 次

quartz 怎么立即执行
现在 有3个定时任务 
1 每个月6号执行
2 周1删除某些数据
3 周五修改

到时间执行倒是没问题,但是如果服务器在执行的前一秒挂了 在重启服务器后时间过了
这个应该怎么处理?

配置文件:
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
        <!-- 要调用的工作类 -->
    <!-- 每月6号执行 -->
        <bean id="Job1" class="cn.jq.rb.Dao.impl.QuertzImpl"></bean>
       
        <!-- job 1                 start            -->
        <bean id="jobtask1" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
            <!-- 调用的类 -->
            <property name="targetObject">
             <ref bean="Job1"/>
            </property>
            <!-- 调用类中的方法 -->
            <property name="targetMethod">
                <value>work1</value>
            </property>
        </bean>
        <!-- 定义触发时间 -->
        <bean id="doTime1" class="org.springframework.scheduling.quartz.CronTriggerBean">
            <property name="jobDetail">
                <ref bean="jobtask1"/>
            </property>
            <!-- cron表达式 -->
            <property name="cronExpression">
                <!--间隔-->
                <value>0 0 0 6 * ?</value>
            </property>
      &nb