You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Kelvin Tan <ke...@relevanz.com> on 2002/01/31 07:30:41 UTC

[PATCH] Running Fulcrum's Scheduler tasks once upon initialization

I've found the need to run tasks in cold storage once upon initialization of the SchedulerService, and then at the specified intervals after that.

Here's the patch for it, if someone finds it useful. (I'm not too sure why the "/**" appear at the wrong places...)



cvs diff TurbineSchedulerService.java (in directory C:\checkout\jakarta-turbine-fulcrum\src\services\java\org\apache\fulcrum\schedule\)
Index: TurbineSchedulerService.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/schedule/TurbineSchedulerService.java,v
retrieving revision 1.3
diff -r1.3 TurbineSchedulerService.java
90a91,95
>      * Should tasks be run when the service is initialized?
>      */
>     protected boolean runTasksOnInit = false;
> 
>     /**
110a116,117
>         runTasksOnInit = getConfiguration().
>                     getBoolean(ScheduleService.RUN_TASKS_ON_INIT_KEY, false);
121,122c128
<                 Iterator it = jobs.iterator();
<                 while(it.hasNext())
---
>                 if(!runTasksOnInit)
124c130,135
<                     ((JobEntry)it.next()).calcRunTime();
---
>                     Iterator it = jobs.iterator();
>                     while(it.hasNext())
>                     {
>                         JobEntry je = (JobEntry)it.next();
>                         je.calcRunTime();
>                     }


cvs diff ScheduleService.java (in directory C:\checkout\jakarta-turbine-fulcrum\src\services\java\org\apache\fulcrum\schedule\)
Index: ScheduleService.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/schedule/ScheduleService.java,v
retrieving revision 1.2
diff -r1.2 ScheduleService.java
71a72,78
>      * The key in ScheduleService properties in TurbineResources.properties
>      * that determines if tasks should be run when the service is
>      * initialized.
>      */
>     public static final String RUN_TASKS_ON_INIT_KEY = "runTasksOnInit";
> 
>     /**

Regards,
Kelvin Tan

Relevanz Pte Ltd
http://www.relevanz.com

180B Bencoolen St.
The Bencoolen, #04-01
S(189648)

Tel: 238 6229
Fax: 337 4417


Re: [PATCH] Running Fulcrum's Scheduler tasks once upon initialization

Posted by Kelvin Tan <ke...@relevanz.com>.
----- Original Message -----
From: "Daniel Rall" <dl...@finemaltcoding.com>
To: "Turbine Developers List" <tu...@jakarta.apache.org>
Cc: "Kelvin Tan" <ke...@relevanz.com>
Sent: Wednesday, February 13, 2002 10:14 AM
Subject: Re: [PATCH] Running Fulcrum's Scheduler tasks once upon
initialization


> Hey Kelvin, I just reviewed your patch.  I get the feeling that this
> doesn't belong in the SchedulerService (which attempts to provide
> functionality equivalent to a unix cron), and that you'd be better off
> using another mechanism for this.  If this layout really does work out
> for you, just sub-class TurbineSchedulerService and set the
> services.SchedulerService property in your TR.props to the fully
> qualified name of your class.
>
> - Dan

Dan,

Thanks. Sure. I guess unix cron doesn't have that functionality. :)

Well, I thought it'd be something useful to have in a generic scheduler
service. Don't you think so? It would be odd to exclude useful functionality
just to adhere strictly to cron...:)

Regards,
K


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] Running Fulcrum's Scheduler tasks once upon initialization

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Hey Kelvin, I just reviewed your patch.  I get the feeling that this
doesn't belong in the SchedulerService (which attempts to provide
functionality equivalent to a unix cron), and that you'd be better off
using another mechanism for this.  If this layout really does work out
for you, just sub-class TurbineSchedulerService and set the
services.SchedulerService property in your TR.props to the fully
qualified name of your class.

- Dan

"Kelvin Tan" <ke...@relevanz.com> writes:

> I've found the need to run tasks in cold storage once upon initialization of the SchedulerService, and then at the specified intervals after that.
>
> Here's the patch for it, if someone finds it useful. (I'm not too sure why the "/**" appear at the wrong places...)
>
>
>
> cvs diff TurbineSchedulerService.java (in directory C:\checkout\jakarta-turbine-fulcrum\src\services\java\org\apache\fulcrum\schedule\)
> Index: TurbineSchedulerService.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/schedule/TurbineSchedulerService.java,v
> retrieving revision 1.3
> diff -r1.3 TurbineSchedulerService.java
> 90a91,95
> >      * Should tasks be run when the service is initialized?
>>      */
>>     protected boolean runTasksOnInit = false;
>> 
>>     /**
> 110a116,117
> >         runTasksOnInit = getConfiguration().
>>                     getBoolean(ScheduleService.RUN_TASKS_ON_INIT_KEY, false);
> 121,122c128
> <                 Iterator it = jobs.iterator();
> <                 while(it.hasNext())
> ---
> >                 if(!runTasksOnInit)
> 124c130,135
> <                     ((JobEntry)it.next()).calcRunTime();
> ---
> >                     Iterator it = jobs.iterator();
>>                     while(it.hasNext())
>>                     {
>>                         JobEntry je = (JobEntry)it.next();
>>                         je.calcRunTime();
>>                     }
>
>
> cvs diff ScheduleService.java (in directory C:\checkout\jakarta-turbine-fulcrum\src\services\java\org\apache\fulcrum\schedule\)
> Index: ScheduleService.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/schedule/ScheduleService.java,v
> retrieving revision 1.2
> diff -r1.2 ScheduleService.java
> 71a72,78
> >      * The key in ScheduleService properties in TurbineResources.properties
>>      * that determines if tasks should be run when the service is
>>      * initialized.
>>      */
>>     public static final String RUN_TASKS_ON_INIT_KEY = "runTasksOnInit";
>> 
>>     /**

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] Running Fulcrum's Scheduler tasks once upon initialization

Posted by Kelvin Tan <ke...@relevanz.com>.
Posted this patch last week. Wondering if anyone's interested in it to commit it...
  ----- Original Message ----- 
  From: Kelvin Tan 
  To: Turbine Developers List 
  Sent: Thursday, January 31, 2002 2:30 PM
  Subject: [PATCH] Running Fulcrum's Scheduler tasks once upon initialization


  I've found the need to run tasks in cold storage once upon initialization of the SchedulerService, and then at the specified intervals after that.

  Here's the patch for it, if someone finds it useful. (I'm not too sure why the "/**" appear at the wrong places...)



  cvs diff TurbineSchedulerService.java (in directory C:\checkout\jakarta-turbine-fulcrum\src\services\java\org\apache\fulcrum\schedule\)
  Index: TurbineSchedulerService.java
  ===================================================================
  RCS file: /home/cvspublic/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/schedule/TurbineSchedulerService.java,v
  retrieving revision 1.3
  diff -r1.3 TurbineSchedulerService.java
  90a91,95
  >      * Should tasks be run when the service is initialized?
  >      */
  >     protected boolean runTasksOnInit = false;
  > 
  >     /**
  110a116,117
  >         runTasksOnInit = getConfiguration().
  >                     getBoolean(ScheduleService.RUN_TASKS_ON_INIT_KEY, false);
  121,122c128
  <                 Iterator it = jobs.iterator();
  <                 while(it.hasNext())
  ---
  >                 if(!runTasksOnInit)
  124c130,135
  <                     ((JobEntry)it.next()).calcRunTime();
  ---
  >                     Iterator it = jobs.iterator();
  >                     while(it.hasNext())
  >                     {
  >                         JobEntry je = (JobEntry)it.next();
  >                         je.calcRunTime();
  >                     }


  cvs diff ScheduleService.java (in directory C:\checkout\jakarta-turbine-fulcrum\src\services\java\org\apache\fulcrum\schedule\)
  Index: ScheduleService.java
  ===================================================================
  RCS file: /home/cvspublic/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/schedule/ScheduleService.java,v
  retrieving revision 1.2
  diff -r1.2 ScheduleService.java
  71a72,78
  >      * The key in ScheduleService properties in TurbineResources.properties
  >      * that determines if tasks should be run when the service is
  >      * initialized.
  >      */
  >     public static final String RUN_TASKS_ON_INIT_KEY = "runTasksOnInit";
  > 
  >     /**

  Regards,
  Kelvin Tan

  Relevanz Pte Ltd
  http://www.relevanz.com

  180B Bencoolen St.
  The Bencoolen, #04-01
  S(189648)

  Tel: 238 6229
  Fax: 337 4417