@@ -6,7 +6,7 @@ namespace InEngine.Core.Scheduling
66{
77 public class Occurence
88 {
9- public IScheduler Scheduler { get ; set ; } = StdSchedulerFactory . GetDefaultScheduler ( ) ;
9+ public Schedule Schedule { get ; set ; }
1010 public AbstractCommand Command { get ; set ; }
1111 public IJobDetail JobDetail { get ; set ; }
1212
@@ -16,32 +16,36 @@ public static TriggerBuilder MakeTriggerBuilder(AbstractCommand command)
1616 throw new ArgumentNullException ( command . GetType ( ) . Name , "The command to schedule cannot be null." ) ;
1717 return TriggerBuilder
1818 . Create ( )
19- . WithIdentity ( $ "{ command . Name } :job:{ command . ScheduleId } ", command . SchedulerGroup ) ;
19+ . WithIdentity ( $ "{ command . Name } :job:{ command . ScheduleId } ", command . SchedulerGroup ) ;
2020 }
2121
2222 public void RegisterJob ( Action < DailyTimeIntervalScheduleBuilder > action )
2323 {
24- Scheduler . ScheduleJob ( JobDetail , MakeTriggerBuilder ( Command ) . WithDailyTimeIntervalSchedule ( action ) . Build ( ) ) ;
24+ Schedule . RegisterJob ( Command , JobDetail , MakeTriggerBuilder ( Command ) . WithDailyTimeIntervalSchedule ( action ) . Build ( ) ) ;
2525 }
2626
2727 public void RegisterJob ( string cronExpression )
2828 {
29- Scheduler . ScheduleJob ( JobDetail , MakeTriggerBuilder ( Command ) . WithCronSchedule ( cronExpression ) . Build ( ) ) ;
29+ Schedule . RegisterJob ( Command , JobDetail , MakeTriggerBuilder ( Command ) . WithCronSchedule ( cronExpression ) . Build ( ) ) ;
3030 }
3131
3232 public void RegisterJob ( Action < SimpleScheduleBuilder > action )
3333 {
34- Scheduler . ScheduleJob ( JobDetail , MakeTriggerBuilder ( Command ) . WithSimpleSchedule ( action ) . Build ( ) ) ;
34+ Schedule . RegisterJob ( Command , JobDetail , MakeTriggerBuilder ( Command ) . WithSimpleSchedule ( action ) . Build ( ) ) ;
3535 }
3636
3737 public void Cron ( string cronExpression )
3838 {
3939 RegisterJob ( cronExpression ) ;
4040 }
4141
42- public void EverySecond ( )
42+ public LifecycleActions EverySecond ( )
4343 {
4444 RegisterJob ( x => x . WithIntervalInSeconds ( 1 ) . RepeatForever ( ) ) ;
45+ return new LifecycleActions ( )
46+ {
47+ Command = Command
48+ } ;
4549 }
4650
4751 public void EveryMinute ( )
0 commit comments