ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darren Davison <dar...@davisononline.org>
Subject Re: clustered cache on Tomcat - can't shutdown
Date Wed, 30 Jul 2008 13:14:41 GMT
On Wed, Jul 30, 2008 at 04:37:18AM -0700, nch wrote:
>    Hi, Darren.
>    Can you give me some guidelines on how to reproduce your configuration?
>    I'm interested on this topic.

sure, though to be clear, the setup is not actually a "clustered cache"
as I freely described it earlier :)  Each Tomcat has its own,
independent copy of each cacheModel.  OScache is used as the cache type
and jgroups is used simply to ensure that if one cache on one server
gets flushed, the call is duplicated on the other instances.  This works
best I think when using sticky sessions versus session replication at
the web tier.

That said, the salient bits of config are:

<!-- config file -->
<sqlMapConfig>
    <settings cacheModelsEnabled="true" />
	...
</sqlMapConfig>


<!-- sql map file -->
<cacheModel id="someCache" type="OSCACHE" readOnly="true"
serialize="false">
  ...
</cacheModel>


#oscache.properties.. locate in root of classpath ie WEB-INF/classes
cache.event.listeners=com.opensymphony.oscache.plugins.clustersupport.JavaGroupsBroadcastingListener,com.opensymphony.oscache.extra.CacheMapAccessEventListenerImpl

You will need to add oscache.jar and the jgroups-all.jar which came with
your oscache download to WEB-INF/lib (or somewhere else that Tomcat can
get at them).

That's about it.  However, on some platforms, you may find you also need
to explicitly set IPv4 networking on the JVM that Tomcat uses or jgroups
gets upset.  If so, add the following vm arg to your JAVA_OPTS in the
tomcat startup scripts:

-Djava.net.preferIPv4Stack=true


Good luck - and if in the process you figure out the answer to my
original query, post back :)

[actually I can probably just subclass the OSCacheController and expose
the GeneralCacheAdministrator.  Though a method in the ibatis code to
delegate to its destroy() method would be preferable I think]

D.

-- 
Darren Davison
Public Key: 0xE855B3EA

Mime
View raw message