1 Reply Latest reply on Feb 9, 2010 12:49 PM by Galder Zamarreño

    How do I avoid cluster collisions on the same subnet for cache invalidation?

    Josh Long Newbie



      I have a setup with JBoss Seam. I'm using JBoss Cache as the backing caching framework for JPA (Hibernate).


      I also accquire a reference to the Cache that HIbernate creates when it starts up and get at a few cache configurations of my own for other purposes (ie, theres enitty-cache, query-cache, etc, that are there for Hibernate, and theres another configuratio that I use for my own purposes.)


      The effect is thatId ont have to create two cache instances in the same web application.


      Now, my problem: jboss cache is clustered. It has a clusterName attribute. If i launch the jboss cache instance in two different environemtns but the same subnet (staging, test, for example) theres teh risk of collision  - how do I ensure that thed query-cache from staging doesnt share /replicate/invalidate the query-cache for testing?


      I looked at the cluster name attriute for each config in jbc2.xml (we have a custom one that's based on the default one), and that might work as long a I change the cluster names for each build. Id also need to bifurcate the persistence.xml into two separate configurations or do some sort of nasty property filtering so that I can confure stagins query cache as:

      hibernate.cache.region.jbc2.cfg.query=staging-query-cache in staging, and hibernate.cache.region.jbc2.cfg.query=test-query-cache in test.


      So, what Im asking is:

      a) is cluster name the way to ensure two clusters dont trample on each other?

      b) is there another way that doesnt leave me creating two diffrent jbc2.xml and persistence.xml files for each environment, or at least reduces it? I noticed that you can interpolae system properties in jbc2.xml - but not in persistence.xml, which means I couldnt just use a system property and cange it per environment in the tocat startup script.


      Thanks, any and all insight's appreciated.