Announcement Announcement Module
Collapse
No announcement yet.
Crone job using Quartz Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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.

      Comment

      Working...
      X