Brett suggested that I propose my idea for the scheduler before
actually committing any work and I agree.
So here is a first hack -
In general, the Turbine scheduler should be a "cron-tab" like
utility that wakes-up ocassionally and performs some pre-defined
task either locally or on some remote Turbine application.
Here's kind of an abstract model:
The scheduler is a singleton class that contains a sorted queue.
The queue is maintained by a thread that wakes-up ocassionally ( as
defined by the next JobEntry) and starts the process of executing the
task.
Each queue contains 0-many JobEntries. A JobEntry is a wrapper
class the contains a Task to run and information about the Task. Information about the
task should include such things as: when to run the job and is the job a one time
thing or reoccuring.
Jobs can be run by a specific date or time.
Besides scheduling information, a JobEnty also contains the Task to perform. A Task
is an interface that looks something like this:
public interface Task{
public abstract Object execute(JobEntry entry);
}
Any scheduled task must implement this interface.
Issues:
1. IMO, the scheduler needs to start automatically on Turbine
start up. I'm thinking that it should be started in the Turbine.init(). The init()
could check a property value and determine whether
you want to run the scheduler or not. (i.e. scheduler.start=false)
2. Add a small DB table and scheduler UI so that tasks are persistent
in the event of a crash. The scheduler UI can allow an authorized user to load,
unload, or reschedule a task.
3. Remote scheduling using XML-RPC (as suggested by Brett).
The scheduled Task could be an XML-RPC client that invokes
an XML-RPC server aware Action on a remote machine. Add security
checks to the Action to prevent any unauthorized stuff.
I hope I'm not getting to carried away on this, but I think this could be an important
addition.
Please give me your feedback.
Thanks,
Dave
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]