01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
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.12 2007/02/11 19:21:12 nklasens Exp $
26: */
27: public class ModuleProbe extends DaemonThread {
28:
29: private static final Logger log = Logging
30: .getLoggerInstance(ModuleProbe.class);
31:
32: public ModuleProbe() {
33: super ("ModuleProbe");
34: }
35:
36: /**
37: * Invoke the maintainance method of all active MMBase modules.
38: */
39: public void executeTask() {
40: // call each module's maintenance routine
41: try {
42: Iterator<Module> i = Module.getModules();
43: while (i != null && i.hasNext()) {
44: Module module = i.next();
45: try {
46: module.maintainance();
47: } catch (RuntimeException e) {
48: log
49: .error("Exception on maintainance call of "
50: + module.getName() + " : "
51: + e.getMessage());
52: }
53: }
54: } catch (ConcurrentModificationException cme) {
55: log
56: .debug("Module list changed - abort current probe, try again later");
57: }
58: }
59: }
|