Finally, I don't have to realize Timer, I found Quartz this Scheduling Solution Tool. It is OpenSymphony's stuff.
Quartz is still nice, separated Trigger and Job strictly separate, but its JobDetail is not tired. Of course, if the implementation status and execution of the execution state dependent on JOB, it is not very good, but it is only a bit troublesome.
So, I have packaged it, at least you can block JobDetail in the outside. In fact, this shielded idea, I prefer OsWorkflow's function, or JBPM's Action's processing ideas.
Public Abstract Class QuartzJob IMPLEments JOB {
Public void Execute (JobexecutionContext Context) throws jobexecutionException {
EXE (CONTEXT.GETJOBDETAIL (). getJobDataMap (). getWrappedMap ());
System.out.print ("Trigger" Context.gettrigger (). GetName () "Executed");
}
Public Abstract Void EXE (Map Map);
}
Of course, Quartz supports Clustering and Failover, which is provided by its support for DB Persistence. Of course, for large projects, this processing method of Quartz is good, but for many small and medium-sized projects, individual feels that if Quartz provides a way to "object serialization to file", it seems more convenient.