QUARTZ SCHEDULER AND LOGGING

来源:互联网 发布:安卓流畅优化软件 编辑:程序博客网 时间:2024/06/03 23:39

spring comes with two subclasses of trigger: simplertriggerbean and crontriggerbean. simplertiggerbean is very similar to

scheduledtimertask. you can specify how often a job should run and how long to wait before running the job for the first

time.crontiggerbean is another spring subclass of quartz's tigger class. this trigger class lets you specify exact times and

days when the job will run. crontirggerbean lets you use a cron expression to specify exact times that a job will run.  the

cronexpression property tells the trigger when to fire. cronexpression is made up of six time elements separated by

spaces. the quartz.properties file defines the runtime behavior of the quartz application and contains many properties that

can be set to control how quartz behaves.you should use one of the factory methods to ensure that all facets of the

scheduler are instantiated and initialized properly. quickly simply, a quartz job is a java class that performs a task on your

behalf. when the scheduler calls a job, a jobexecutioncontext is passed to the execute method. the job executioncontext is

an object that gives the job access to the runtime environment of quartz and the detaild of job itself. this is analogous to a

java web application in which a servlet has access to the servletcontext. from rhe jobexecutioncontext, the job can access

everything about its environment including the jobdetail and trigger that were registered with the scheduler for the job. the

question mark character can be used only in the dayofmoneth and day of week fields,but not at the same time. you can

think of the ? character as i donot care what valur is in this field. the scheduler uses the configured jobstore to store and

retrieve scheduling information and to determine its responsibilities for triggering jobs. quartz supports several different

types of storage mechanisms for scheduler information.  the api for the jobstore interface can be generated into the

following categories: job-related api trigger-related api calendar-related api and scheduler-related api. rmi is a

mechanism that enables an object in one address space to cummunicate with obhecrs in a different address space.

logging is a systematic and controlled way of representing the state of an application in a human-readable fashion. the

logging components have the freedom to publish logging information to any destination of choice such as a file,console,

database,or remote location. a logging package should provide flexibility in terms of what to log and where to log. the jdk

logging api consists of several objects that capture logging information and process and publish the intended logging

information to any preferred destination. the java.util.logging.logrecord object encapsulates all the logging information. the

java.util.logging.handler object is responsible for publishing logging information to various destinations- a file,

console,memory buffer. each logger provides a number of different logging methods.  the streamhandler class acts as a

base class for any stream-based handler. it is possible to specifiy a java.io.outputstream object. a streamhandler acquires the following initialization properties.

原创粉丝点击