KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > module > ModuleProbe


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9  */

10 package org.mmbase.module;
11
12 import java.util.*;
13
14 import org.mmbase.core.util.DaemonThread;
15 import org.mmbase.util.logging.Logger;
16 import org.mmbase.util.logging.Logging;
17
18 /**
19  * ModuleProbe is a deamon thread that periodically calls the maintenance() method
20  * of the modules active in MMBase.
21  * The number of milliseconds of the invocation period is approximately 1 minute.
22  *
23  * @author Pierre van Rooden
24  * @author Daniel Ockeloen
25  * @version $Id: ModuleProbe.java,v 1.11 2005/11/30 15:58:04 pierre Exp $
26  */

27 public class ModuleProbe extends DaemonThread {
28
29     private static final Logger log = Logging.getLoggerInstance(ModuleProbe.class);
30
31     public ModuleProbe() {
32         super("ModuleProbe");
33     }
34
35     /**
36      * Invoke the maintainance method of all active MMBase modules.
37      */

38     public void executeTask() {
39         // call each module's maintenance routine
40
try {
41             Iterator i = Module.getModules();
42             while(i != null && i.hasNext()) {
43                 Module module = (Module) i.next();
44                 try {
45                     module.maintainance();
46                 } catch (RuntimeException JavaDoc e) {
47                     log.error("Exception on maintainance call of " + module.getName() + " : " + e.getMessage());
48                 }
49             }
50         } catch (ConcurrentModificationException cme) {
51             log.debug("Module list changed - abort current probe, try again later");
52         }
53     }
54 }
55
Popular Tags