KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > roller > model > ThreadManager


1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License.
6 * You may obtain a copy 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,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */

18 package org.apache.roller.model;
19
20 import java.util.TimerTask JavaDoc;
21 import java.sql.Date JavaDoc;
22
23 /**
24  * Thread management for executing scheduled and asynchronous tasks.
25  */

26 public interface ThreadManager
27 {
28     public static final long MIN_RATE_INTERVAL_MINS = 1;
29
30     /**
31      * Execute runnable in background (asynchronously).
32      * @param runnable
33      * @throws java.lang.InterruptedException
34      */

35     public void executeInBackground(Runnable JavaDoc runnable)
36             throws InterruptedException JavaDoc;
37
38     /**
39      * Execute runnable in foreground (synchronously).
40      */

41     public void executeInForeground(Runnable JavaDoc runnable)
42             throws InterruptedException JavaDoc;
43
44     /**
45      * Schedule task to run once a day.
46      */

47     public void scheduleDailyTimerTask(TimerTask JavaDoc task);
48
49     /**
50      * Schedule task to run once per hour.
51      */

52     public void scheduleHourlyTimerTask(TimerTask JavaDoc task);
53
54     /**
55      * Schedule task to run at fixed rate.
56      */

57     public void scheduleFixedRateTimerTask(TimerTask JavaDoc task, long delayMins, long periodMins);
58
59     /**
60      * Shutdown
61      */

62     public void shutdown();
63
64     /**
65      * Release all resources associated with Roller session.
66      */

67     public void release();
68 }
Popular Tags