tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: Asynchronous statistics logger
Date Thu, 02 Dec 2004 13:52:28 GMT

A Singleton using Timer/TimerTask is NOT necessarily a bad practice.
There are a lot worse things you could do.  It'd be a lower-maintenance,
lower-overhead, and lower-overall-effort solution over JMS.

Yoav Shapira

>-----Original Message-----
>From: Allistair Crossley []
>Sent: Thursday, December 02, 2004 5:11 AM
>To: Tomcat Users List
>Subject: RE: Asynchronous statistics logger
>this strikes me as being something JMS would handle well, but Tomcat
>doesn't support JMS by default. I have seen people installing openJMS
>Tomcat though.
>as for the startup/shutdown, that's going to be a Context Listener you
>to implement and add to web.xml with <listener>.
>that's about all i can offer on this, sorry :)
>> -----Original Message-----
>> From: Michael Cornell []
>> Sent: 02 December 2004 10:04
>> To:
>> Subject: Asynchronous statistics logger
>> Hi,
>> I am trying to implement an asynchronous statistics logger
>> that would load
>> on startup and be destroyed on shutdown of tomcat.  This
>> logger then needs
>> to write to a log file / to disk / to log4j every x seconds with
>> statistics.
>> Methods to add some statistic to it need to be accessible by all
>> classes in the same context (eg public static void addPageHit(String
>> whatPage, int howBigWasIt); )
>> I have already tried writing an asynchronous Singleton, but
>> this has caused
>> major havoc with threading issues (jdk1.4.2 tomcat 5.0.25
>> redhat linux 9.0).
>> In addition I know this is not good practice.  This singleton
>> was using the
>> Timer and TimerTask for its implementation.
>> What is the best practice for implementing this sort of class ?
>> Thanks
>>  Michael
>> ---
>> Outgoing mail is certified Virus Free.
>> Checked by AVG anti-virus system (
>> Version: 6.0.788 / Virus Database: 533 - Release Date: 01/11/2004
>QAS Ltd.
>Developers of QuickAddress Software
><a href=""></a>
>Registered in England: No 2582055
>Registered in Australia: No 082 851 474
>To unsubscribe, e-mail:
>For additional commands, e-mail:

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message