5 Replies Latest reply on Aug 21, 2004 3:51 AM by dannyb23

    scheduler at midnight

    dannyb23 Newbie

      Hi

      How can I update the following xml snippet so that it would be scheduled to every day at midnight ? I have tried updating InitialStartDate to midnight without success...


      true
      mypacakge.util.jmx.JMXLogScheduler


      NOW
      10000
      -1


        • 1. Re: scheduler at midnight
          dannyb23 Newbie

          opps the snipped wasnt seen correctly here it is :

          mbean code="org.jboss.varia.scheduler.Scheduler"
          name=":service=Scheduler"
          attribute name="StartAtStartup"true/attribute
          attribute name="SchedulableClass"mypackage.util.jmx.JMXLogScheduler/attribute
          attribute name="SchedulableArguments"/attribute
          attribute name="SchedulableArgumentTypes"/attribute
          attribute name="InitialStartDate"NOW/attribute
          attribute name="SchedulePeriod"10000/attribute
          attribute name="InitialRepetitions"-1/attribute
          /mbean

          • 2. Re: scheduler at midnight
            dannyb23 Newbie

            Hi

            I would really appreciate any help on this:

            When i'm using:

            attribute name="InitialStartDate"2/5/02 07:21 pm/attribute
            attribute name="SchedulePeriod"10000/attribute
            attribute name="InitialRepetitions"-1/attribute

            The scheduler works every 10 seconds with no consideration of the start date. (even if the start hour is less then this current hour it starts working)

            When I'm using:

            attribute name="InitialStartDate"2/5/02 07:21 pm/attribute
            attribute name="SchedulePeriod"10000/attribute
            attribute name="InitialRepetitions"1000/attribute

            Then the scheduler never works ...


            why is that?

            (all I want is the scheduler to work every night at midnight... :/ )

            • 3. Re: scheduler at midnight
              Torsten Terp Newbie

              Hi,

              I use something like this:

               <mbean code="org.jboss.varia.scheduler.Scheduler" name="myService:service=MyScheduler">
               <attribute name="StartAtStartup">true</attribute>
               <attribute name="SchedulableClass">my.schedulable.class</attribute>
               <attribute name="SchedulableArguments">myArg</attribute>
               <attribute name="SchedulableArgumentTypes">java.lang.String</attribute>
               <attribute name="DateFormat">dd-MM-yy HH:mm</attribute>
               <attribute name="InitialStartDate">01-01-01 00:00</attribute>
               <attribute name="SchedulePeriod">86400000</attribute>
               <attribute name="InitialRepetitions">-1</attribute>
               <depends-list>
              


              Hope it helps..

              T!

              • 4. Re: scheduler at midnight
                dannyb23 Newbie

                Thanks but it didnt work :/ (I have tested it with 5000 ms , perhaps you should too since with such a big SchedulePeriod as you specified perhaps it didnt really work exactly at midnight for you too ? )

                Is your scheduler implementing org.jboss.varia.scheduler.Schedulable ?

                what jboss version are you using ? (i'm using 3.2.5)

                Here is my full code , jboss-service.xml + scheduler class ...

                 <mbean code="org.jboss.varia.scheduler.Scheduler"
                 name=":service=Scheduler">
                 <attribute name="StartAtStartup">true</attribute>
                 <attribute name="SchedulableClass">mypackage.util.jmx.JMXLogScheduler</attribute>
                 <attribute name="SchedulableArguments"></attribute>
                 <attribute name="SchedulableArgumentTypes"></attribute>
                 <attribute name="DateFormat">dd-MM-yy HH:mm</attribute>
                 <attribute name="InitialStartDate">01-01-01 00:00</attribute>
                 <attribute name="SchedulePeriod">5000</attribute>
                 <attribute name="InitialRepetitions">-1</attribute>
                 </mbean>
                


                And the class

                package mypackage.util.jmx;
                
                import org.apache.log4j.Category;
                import org.jboss.varia.scheduler.Schedulable;
                
                public class JMXLogScheduler implements Schedulable {
                
                 protected Category _log = Category.getInstance(getClass());
                
                 public void perform(Date pTimeOfCall, long pRemainingRepetitions) {
                 _log.debug("scheduler perform!");
                 }
                }
                


                the scheduler starts up running immediately... instead of how I specified :

                <attribute name="InitialStartDate">01-01-01 00:00</attribute>
                


                • 5. Re: scheduler at midnight
                  dannyb23 Newbie

                  Its fine! my mistake :O

                  setting the scheduled period to : 86400000 and its perfect.