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

quartz重复问题
下面是我在网上下的配置文件,都会打印一段话,但不知道为什么结果不对
quartzJob:我设定的是30秒一次 
quartzJob2: 1分钟执行一次
打印结果如下:
1111Thu Apr 11 09:32:30 CST 2013
******************

1111Thu Apr 11 09:33:00 CST 2013
******************
222222Thu Apr 11 09:33:00 CST 2013
==============

1111Thu Apr 11 09:33:30 CST 2013
******************

1111Thu Apr 11 09:34:00 CST 2013
******************
222222Thu Apr 11 09:34:00 CST 2013
==============

1111Thu Apr 11 09:34:30 CST 2013
******************

1111Thu Apr 11 09:35:00 CST 2013
******************
222222Thu Apr 11 09:35:00 CST 2013
==============


问题:为什么打印1以后 打印2的时候1也要打印一次?


<?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">
        <!-- 要调用的工作类 -->
        <bean id="quartzJob" class="cn.jq.com.utils.MyQuartz"></bean>
        <bean id="quartzJob2" class="cn.jq.com.utils.MyQuartz2"></bean>
        <!-- 定义调用对象和调用对象的方法 -->
        <bean id="jobtask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
            <!-- 调用的类 -->
            <property name="targetObject">
             <ref bean="quartzJob"/>
            </property>
            <!-- 调用类中的方法 -->
            <property name="targetMethod">
                <value>work</value>
            </property>
        </bean>
        <!-- 定义触发时间 -->
        <bean id="doTime" class="org.springframework.scheduling.quartz.CronTriggerBean">
            <property name="jobDetail">
                <ref bean="jobtask"/>
         &nbs