Quoting Niclas Hedhman <[email protected]>:
> On Wed, Dec 8, 2010 at 5:37 PM, Paul Merlin <[email protected]> wrote:
> > To keep you informed, Qi4j Scheduler implementation is going well. I'm
> > writing it externally before importing code in qi4j-librar...@develop so
> > the code history will be simple.
>
> Don't worry about history :-)
>
> I'd rather see the code evolve in front of me, especially since I have
> fairly immediate need of this too.
Ok, I'll push as soon as I find time, probably this weekend.
> > For now the scheduler use cron expressions (extended to seconds) and
> > support persistent and volatile schedules.
>
> So, I create one Schedule per 'execution pattern', and then associate
> Tasks with that Schedule?
>
> If so, sounds reasonable, and in direct analogy of Timer and TimerTask.
That's the idea but I made the api in a way that the SchedulerService "user" is
not aware of that, he just schedule Tasks and the SchedulerService handle the
Schedule creation and Task/Schedule relation.
We'll continue talking about all that once we all have the code available.
> > It use two entities, Schedule and Task. There is no directly usable
> > TaskEntity for now but code is provided so that you can write your taks
> > with something like:
> >
> > @Mixins(FooTaskMixin.class)
> > interface FooTaskEntity extends Task, EntityComposite {}
> >
> > class FooTaskMixin implements TaskBehavior { void run() {...} }
>
> Should Task and TaskBehavior match? Or is TaskBehavior a superclass of
> Task?
interface Task extends TaskState, TaskBehavior {}
> > The SchedulerService use a pulse-thread with a configurable rhythm that
> > enqueue tasks in a thread pool (size is configurable too).
>
> A common technique I used way back in the past, where the Scheduler
> and Timers were actually the same thing, was to 'know' the 'nextTime'
> for each Task, instead of recalcing the schedule every second. This
> might be not relevant in these days and times, and that your 'tick
> frequency' is fairly long (second(s) I would guess), and I supported
> from 10ms to years in the same scheduler.
Yep I use UnitOfWorkCallback mechanism so that each Task has a nextRun property
computed by the associated Schedule.
Paul
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev