Results 1 to 3 of 3

Thread: Crone job using Quartz

  1. #1
    Join Date
    Apr 2006
    Location
    Lahore, Pakistan
    Posts
    47

    Exclamation Crone job using Quartz

    Hi,

    I've implemented Spring job scheduling and I have made a daily job which executes every day at a specific time. It executes at the specified time but the problem is it executes twice which is not needed.
    Configuration in the XML is as under


    Trigger Bean:
    <bean id="dailyTrigger" class="com.framework.jobs.BaseCronTriggerBean">
    <property name="jobDetail" ref="dailyJobDetail"/>
    <property name="cronExpression" value="00 00 17 * * ? 2007"/> </bean>


    Job detail specifying the method to execute:

    <bean id="dailyJobDetail" class="com.framework.jobs.BaseMethodInvokingJobDet ailFactoryBean">
    <property name="targetObject" ref="packageScheduler"/>
    <property name="targetMethod" value="doIt"/>
    </bean>

    Bean containing the method that executes:

    <bean name="packageScheduler" class="com.vopium.scheduler.PackageScheduler" >
    <property name="callDetailRecordServiceInterface" ref="callDetailRecordServiceImpl"/>
    </bean>



    List of triggers to fire:

    <bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
    <property name="triggers">
    <list>
    <ref bean="dailyTrigger" />
    </list>
    </property>
    </bean>

  2. #2
    Join Date
    Nov 2005
    Posts
    148

    Default

    Hi,

    Apparently its correct.Can u provide "packageScheduler"'s code? just code without ur business logic code. i want to see the ur code sequence.

    Regards,
    shahzad

  3. #3
    Join Date
    Apr 2006
    Location
    Lahore, Pakistan
    Posts
    47

    Question

    Here's the code

    public class PackageScheduler {
    public PackageScheduler() {
    super();
    }

    public void doIt(){
    logger.info("crone method called ");
    writeTestFile();

    }
    }


    on the specified time the message "crone method called" printed twice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •