Hi,
I'm using the crontab module (version 20040406). I use the following
run() method to start the job:
public void run () {
Thread kicker = Thread.currentThread();
if(kicker.getName().indexOf("XMLReaderThread")==-1) {
kicker.setName("XMLReaderThread / " + (new Date()));
kicker.setPriority(Thread.MIN_PRIORITY+1);
}
log.info("run(): " + kicker);
try {
readXML();
} catch(Exception e) {
log.error("run(): ERROR: Exception in xmlreaderhandler thread");
log.error(Logging.stackTrace(e));
}
}
It all works perfect. The only thing which i encounter is that the
number of threads seems to increase with each time the job is carried
out. See listing below and notice the WARNING when a new job tries to
start when the present job is still running.
Some questions:
-Does the counter in the warnings give the correct number of threads
running?
-If yes, is it something to worry about? Will the used threads stop by
themselves or do i have to add some code to the run() method?
-Is it something which is solved in newer versions of the crontab module
and how stable is the present version?
Thanks in advance.
Kind regards, Henk.
2004-10-04 14:14:59,638 INFO org.mmbase.module.Module
- Starting module crontab
2004-10-04 14:14:59,654 INFO mmbase.applications.crontab.JCronDaemon
- Added to JCronDaemon testjob:*/1 5-23 * * *:read tablesweb:
nl.mmatch.XMLReader:null: 0
2004-10-04 14:15:03,498 INFO nl.mmatch.XMLReader
- run(): Thread[XMLReaderThread / Mon Oct 04 14:15:00 CEST 2004,2,main]
2004-10-04 14:15:59,998 WARN mmbase.applications.crontab.JCronDaemon
- Job testjob:*/1 5-23 * * *:read tablesweb: nl.mmatch.XMLReader:null: 1
still running, so not restarting it again.
2004-10-04 14:16:59,998 INFO nl.mmatch.XMLReader
- run(): Thread[XMLReaderThread / Mon Oct 04 14:16:59 CEST 2004,2,main]
2004-10-04 14:17:00,044 WARN mmbase.applications.crontab.JCronDaemon
- Job testjob:*/1 5-23 * * *:read tablesweb: nl.mmatch.XMLReader:null: 2
still running, so not restarting it again.
3 still running, 4 still runing, etc. etc.