We have some apps that use a page with a button on it and other apps that use 
JMX for flushing the cache.  It depends on who wants to flush the cache.  If 
it's an ops group and there are other JMX things they're watching/using, JMX 
can be good.  If it's a user group, then a UI would might be better (having end 
users use jconsole seems painful in several ways).

Implementing your own MBean in Tomcat is not as trivial as it is in JBoss, but 
doesn't take much:

    http://oss.wxnet.org/mbeans.html

I think you can configure log4j to watch the config file and read changes on 
the fly.  Check out ReloadingPropertyConfigurator and/or 
PropertyConfigurator.configureAndWatch() to start.

-----Original Message-----
From: Rick [mailto:ric...@gmail.com]
Sent: Fri 12/26/2008 1:38 PM
To: user-java@ibatis.apache.org
Subject: [OT sort of] If using Tomcat, what would you use to hook into 
slqlmapclient flushDataCache (and change logging)?
 
In this current Tomcat web app I'm going to need a way to A) switch
the logging level of the webapp on the fly (from info/warn to maybe
debug) and B) a way to manually flush all ibatis caches without
restarting the application.  I see a SqlMapClient implementation has a
flushDataCache method to flush the complete cache.

I'm curious, though, what you guys that have worked with Tomcat use to
help in these tasks? JMX/MBeans are easy with JBoss but when briefly
researching this for Tomcat I amazed at the lack of documentation and
examples. Because the information is so sparse, I'm assuming people
create hooks into their app by other means? Is the easiest just to
create some protected admin page as part of your webapp and just hook
into a servlet to make the calls?

What is the approach most take when they want to accomplish the above
tasks using a simple appserver?

Thanks

-- 
Rick


Reply via email to