Hi,
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 http://www.yoavshapira.com


>-----Original Message-----
>From: Allistair Crossley [mailto:[EMAIL PROTECTED]
>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
on
>Tomcat though.
>
>as for the startup/shutdown, that's going to be a Context Listener you
want
>to implement and add to web.xml with <listener>.
>
>that's about all i can offer on this, sorry :)
>
>> -----Original Message-----
>> From: Michael Cornell [mailto:[EMAIL PROTECTED]
>> Sent: 02 December 2004 10:04
>> To: [EMAIL PROTECTED]
>> 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
these
>> statistics.
>>
>> Methods to add some statistic to it need to be accessible by all
other
>> 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 (http://www.grisoft.com).
>> Version: 6.0.788 / Virus Database: 533 - Release Date: 01/11/2004
>>
>
>
><FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE>
>-------------------------------------------------------
>QAS Ltd.
>Developers of QuickAddress Software
><a href="http://www.qas.com";>www.qas.com</a>
>Registered in England: No 2582055
>Registered in Australia: No 082 851 474
>-------------------------------------------------------
></FONT>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to