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.builders;
11:
12: /**
13: * @javadoc
14: * @application Tools
15: * @version $Id: MMEventsProbe.java,v 1.10 2007/08/02 13:26:09 michiel Exp $
16: * @author Daniel Ockeloen
17: */
18: public class MMEventsProbe implements Runnable {
19:
20: Thread kicker = null;
21: MMEvents parent = null;
22:
23: public MMEventsProbe(MMEvents parent) {
24: this .parent = parent;
25: init();
26: }
27:
28: public void init() {
29: this .start();
30: }
31:
32: /**
33: * Starts the admin Thread.
34: */
35: public void start() {
36: if (kicker == null) {
37: kicker = org.mmbase.module.core.MMBaseContext.startThread(
38: this , "mmevents");
39: }
40: }
41:
42: /**
43: * Stops the admin Thread.
44: */
45: public void stop() {
46: // how is this ever called?
47:
48: // iow, why is there no MMObjectBuilder#shutdown method (this thing is started in MMEvents,
49: // so it should also be stopped from that, isn't it?)
50:
51: // http://www.mmbase.org/jira/browse/MMB-1491
52: kicker.interrupt();
53: kicker = null;
54: }
55:
56: /**
57: * admin probe, try's to make a call to all the maintainance calls.
58: */
59: public void run() {
60: while (kicker != null) {
61: parent.probeCall();
62: if (Thread.currentThread().isInterrupted())
63: break;
64: }
65: }
66: }
|