File Source: ThreadManager.java
/*
P/P * Method: org.apache.roller.weblogger.business.runnable.ThreadManager__static_init
*/
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
19 package org.apache.roller.weblogger.business.runnable;
20
21 import org.apache.roller.weblogger.WebloggerException;
22 import org.apache.roller.weblogger.business.InitializationException;
23 import org.apache.roller.weblogger.pojos.TaskLock;
24
25
26 /**
27 * Thread management for executing scheduled and asynchronous tasks.
28 */
29 public interface ThreadManager {
30
31 public static final long MIN_RATE_INTERVAL_MINS = 1;
32
33
34 /**
35 * Initialize the thread management system.
36 *
37 * @throws InitializationException If there is a problem during initialization.
38 */
39 public void initialize() throws InitializationException;
40
41
42 /**
43 * Execute runnable in background (asynchronously).
44 * @param runnable
45 * @throws java.lang.InterruptedException
46 */
47 public void executeInBackground(Runnable runnable)
48 throws InterruptedException;
49
50
51 /**
52 * Execute runnable in foreground (synchronously).
53 */
54 public void executeInForeground(Runnable runnable)
55 throws InterruptedException;
56
57
58 /**
59 * Lookup a TaskLock by name.
60 *
61 * @param name The name of the task.
62 * @return The TaskLock for the task, or null if not found.
63 * @throws WebloggerException If there is an error looking up the TaskLock.
64 */
65 public TaskLock getTaskLockByName(String name) throws WebloggerException;
66
67
68 /**
69 * Save a TaskLock.
70 *
71 * @param tasklock The TaskLock to save.
72 * @throws WebloggerException If there is an error saving the TaskLock.
73 */
74 public void saveTaskLock(TaskLock tasklock) throws WebloggerException;
75
76
77 /**
78 * Try to register a lease for a given RollerTask.
79 *
80 * @param task The RollerTask to register the lease for.
81 * @return boolean True if lease was registered, False otherwise.
82 */
83 public boolean registerLease(RollerTask task);
84
85
86 /**
87 * Try to unregister the lease for a given RollerTask.
88 *
89 * @param task The RollerTask to unregister the lease for.
90 * @return boolean True if lease was unregistered (or was not leased), False otherwise.
91 */
92 public boolean unregisterLease(RollerTask task);
93
94
95 /**
96 * Shutdown.
97 */
98 public void shutdown();
99
100
101 /**
102 * Release all resources associated with Roller session.
103 */
104 public void release();
105
106 }
SofCheck Inspector Build Version : 2.18479
| ThreadManager.java |
2009-Jan-02 14:25:44 |
| ThreadManager.class |
2009-Sep-04 03:12:30 |