Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
More About Triggers 
 

In this section we will try to provide the brief description of triggers.

 

More About Triggers

                         

In this section we will try to provide the brief description of triggers. As we know that the trigger objects are used for executing the jobs or firing jobs. When we wish to schedule the jobs, then we can used the properties of triggers. Here we are going to provide two types of triggers like: Simple Trigger and Cron Trigger for scheduling the jobs.

Now, we will see how to use these triggers with the Calendar interface.

Calendars

Quartz Calendars (not java.util.Calendar) objects can be associated with triggers object at the time of the triggers are stored in the scheduler. It is very useful to excluding blocks of time to fire the triggers schedule. For example, we wish to create a trigger that fires a job every weekday at 4.15 am, in this case we would to add a Calendar that excludes all of the holidays.

We are going to implement the Calendar interface:

Here is the code of Calendar interface:

package org.quartz;

  public interface Calendar {
    public boolean isTimeIncluded(long timeStamp);
    public long getNextIncludedTime(long timeStamp);
  }

isTimeIncluded(long timeStamp);
Above method returns a Boolean type values either true or false. Which takes long type value (timeStamp) in milliseconds and included by the Calendar interface.

getNextIncluedeTime(long timeStamp);
This method takes long type value (timeStamp) in millisecond and determine the next time which is included by the Calendar after the given time.

The Quartz consists of the org.quartz.impl.HolidayCalendar class. The Calendar object integrated with the scheduler through the addCalendar() method. If you want to use the HolidayCalendar then first of all you must be initialized it, after that you will use the addExcludedDate(Date date) method in the program. This method is used to exclude the days from the scheduling.

Here we are going to implement a simple Calendar object to add and exclude with it:

HolidayCalendar hcal = new HolidayCalendar();
cal.addExcludedDate(Date date);

sched.addCalendar("myHoliday", hcal, false);

Misfire Instructions
The triggers contains another important property that is "misfire instruction". Sometimes, a persistent trigger misses to its firing time because the scheduler being shutdown, in this case the misfire is occurred. More descriptions about the misfire instruction will provide below with the Simple and Cron Triggers. The misfire instruction can be used with trigger object by using the setMisfireInstruction() method.

                         

» View all related tutorials
Related Tags: c ide list interface script object io ip vi factory trigger instance int this id ai job shutdown if example

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.