KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quartz > spi > TimeBroker


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

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

21 package org.quartz.spi;
22
23 import java.util.Date JavaDoc;
24
25 import org.quartz.SchedulerConfigException;
26 import org.quartz.SchedulerException;
27
28 /**
29  * <p>NOTE: TimeBroker is not currently used in the Quartz code base.</p>
30  *
31  * <p>
32  * The interface to be implemented by classes that want to provide a mechanism
33  * by which the <code>{@link org.quartz.core.QuartzScheduler}</code> can
34  * reliably determine the current time.
35  * </p>
36  *
37  * <p>
38  * In general, the default implementation of this interface (<code>{@link org.quartz.simpl.SimpleTimeBroker}</code>-
39  * which simply uses <code>System.getCurrentTimeMillis()</code> )is
40  * sufficient. However situations may exist where this default scheme is
41  * lacking in its robustness - especially when Quartz is used in a clustered
42  * configuration. For example, if one or more of the machines in the cluster
43  * has a system time that varies by more than a few seconds from the clocks on
44  * the other systems in the cluster, scheduling confusion will result.
45  * </p>
46  *
47  * @see org.quartz.core.QuartzScheduler
48  * @deprecated TimeBroker is not currently used in the Quartz code base.
49  * @author James House
50  */

51 public interface TimeBroker {
52
53     /*
54      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55      *
56      * Interface.
57      *
58      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59      */

60
61     /**
62      * <p>
63      * Get the current time, as known by the <code>TimeBroker</code>.
64      * </p>
65      *
66      * @throws SchedulerException
67      * with the error code set to
68      * SchedulerException.ERR_TIME_BROKER_FAILURE
69      */

70     Date JavaDoc getCurrentTime() throws SchedulerException;
71
72     /**
73      * <p>
74      * Called by the QuartzScheduler before the <code>TimeBroker</code> is
75      * used, in order to give the it a chance to initialize.
76      * </p>
77      */

78     void initialize() throws SchedulerConfigException;
79
80     /**
81      * <p>
82      * Called by the QuartzScheduler to inform the <code>TimeBroker</code>
83      * that it should free up all of it's resources because the scheduler is
84      * shutting down.
85      * </p>
86      */

87     void shutdown();
88
89 }
90
Popular Tags