[Yanel-dev] Integration of quartz scheduler

Guillaume Déflache guillaume.deflache at wyona.com
Fri Dec 11 11:57:33 CET 2009


Michael Wechner schrieb:
> Hi
> 
> I have started the integration of the quartz scheduler, which was rather 
> simple (according to 
> http://www.quartz-scheduler.org/docs/quick_start_guide.html)
> 
> Now the actual design questions arise:
> 
> - How do we want to make this scheduler available to the resources?

I'd say the scheduler should be attached to the Yanel object, or even 
maybe to each Realm object.


> If we want to keep Yanel itself independent of the actual scheduler 
> framework (like for example Quartz), then my suggestion would be to 
> create an interface
> 
> interface ScheduableV1 {
>    void setScheduler(QuartzScheduler);
>    QuartzScheduler getScheduler();
> }

Err... why would you name it QuartzScheduler if it is to be independant?

My draft proposal for now:
---8<---
interface SchedulableV1 {
    void setScheduler(Scheduler);
    Scheduler getScheduler();
}
abstract class Scheduler {
     /**
      * TODO What about notifications of [ab]normal termination?
      * @return jobID
      */
     String schedule(Identity jobOwner, String cronExpression, 
Class<Runnable> jobClass, String... jobParameters);

     Iterable<String> getJobIDs();

     Job getJob(jobID);

     boolean cancelJob(jobID);
}
---8<---
I am not sure that we need IDs, and it may indeed be problematic with 
Unix `cron` (see below) where are simply lines in a file... But then 
canceling a specific job would imply searching among all jobs for the 
given identity, which may be OK.

Or if we do not care about cron (generally speaking: non in-JVM 
execution) we could use 
http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html 
or at least get some inspiration from it.


> because this allows to introduce new scheduler frameworks at some later 
> stage.
> 
> One could argue that there is not much out there than the Quartz 
> Scheduler and we rather couple it to the realm, which

I'd say there is at least cron that sysadmins often prefer when they 
have the choice/can enforce it because that's something they may already 
have to manage anyway.


> leads to another design question:
> 
> - What about cross-scheduling in between realms?
> 
> I could imagine there are case which require something like this, just 
> as cross-reading/writing of content, but
> in most cases I would argue that people don't want to allow to see the 
> scheduled jobs of other realms.

I cannot image the need for this, but sometimes I lack imagination! ;)
Maybe for V2 then?


> - The third questions then would be how do we connect access controlling 
> with scheduling?

Every scheduled job having an URL would be a good start.
Maybe every realm should also have a jobs URL which would hold them 
together?


More information about the Yanel-development mailing list