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" <[EMAIL PROTECTED]> 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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to