KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quartz > TriggerListener


1
2 /*
3  * Copyright 2004-2005 OpenSymphony
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6  * use this file except in compliance with the License. You may obtain a copy
7  * of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14  * License for the specific language governing permissions and limitations
15  * under the License.
16  *
17  */

18
19 /*
20  * Previously Copyright (c) 2001-2004 James House
21  */

22 package org.quartz;
23
24 /**
25  * <p>
26  * The interface to be implemented by classes that want to be informed when a
27  * <code>{@link Trigger}</code> fires. In general, applications that use a
28  * <code>Scheduler</code> will not have use for this mechanism.
29  * </p>
30  *
31  * @see Scheduler
32  * @see Trigger
33  * @see JobListener
34  * @see JobExecutionContext
35  *
36  * @author James House
37  */

38 public interface TriggerListener {
39
40     /*
41      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42      *
43      * Interface.
44      *
45      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46      */

47
48     /**
49      * <p>
50      * Get the name of the <code>TriggerListener</code>.
51      * </p>
52      */

53     String JavaDoc getName();
54
55     /**
56      * <p>
57      * Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code>
58      * has fired, and it's associated <code>{@link org.quartz.JobDetail}</code>
59      * is about to be executed.
60      * </p>
61      *
62      * <p>
63      * It is called before the <code>vetoJobExecution(..)</code> method of this
64      * interface.
65      * </p>
66      *
67      * @param trigger
68      * The <code>Trigger</code> that has fired.
69      * @param context
70      * The <code>JobExecutionContext</code> that will be passed to
71      * the <code>Job</code>'s<code>execute(xx)</code> method.
72      */

73     void triggerFired(Trigger trigger, JobExecutionContext context);
74
75     /**
76      * <p>
77      * Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code>
78      * has fired, and it's associated <code>{@link org.quartz.JobDetail}</code>
79      * is about to be executed.
80      * </p>
81      *
82      * <p>
83      * It is called after the <code>triggerFired(..)</code> method of this
84      * interface.
85      * </p>
86      *
87      * @param trigger
88      * The <code>Trigger</code> that has fired.
89      * @param context
90      * The <code>JobExecutionContext</code> that will be passed to
91      * the <code>Job</code>'s<code>execute(xx)</code> method.
92      */

93     boolean vetoJobExecution(Trigger trigger, JobExecutionContext context);
94
95     
96     /**
97      * <p>
98      * Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code>
99      * has misfired.
100      * </p>
101      *
102      * <p>
103      * Consideration should be given to how much time is spent in this method,
104      * as it will affect all triggers that are misfiring. If you have lots
105      * of triggers misfiring at once, it could be an issue it this method
106      * does a lot.
107      * </p>
108      *
109      * @param trigger
110      * The <code>Trigger</code> that has misfired.
111      */

112     void triggerMisfired(Trigger trigger);
113
114     /**
115      * <p>
116      * Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code>
117      * has fired, it's associated <code>{@link org.quartz.JobDetail}</code>
118      * has been executed, and it's <code>triggered(xx)</code> method has been
119      * called.
120      * </p>
121      *
122      * @param trigger
123      * The <code>Trigger</code> that was fired.
124      * @param context
125      * The <code>JobExecutionContext</code> that was passed to the
126      * <code>Job</code>'s<code>execute(xx)</code> method.
127      * @param triggerInstructionCode
128      * the result of the call on the <code>Trigger</code>'s<code>triggered(xx)</code>
129      * method.
130      */

131     void triggerComplete(Trigger trigger, JobExecutionContext context,
132             int triggerInstructionCode);
133
134 }
135
Popular Tags