[jboss-user] [Clustering/JBoss] - Re: How to make field-granularity-session-cache the default

bstansberry@jboss.com do-not-reply at jboss.com
Mon Jun 15 21:22:52 EDT 2009

The default clustering behavior in AS 5 can be controlled via the server/XXX/deployers/jbossweb.deployer/META-INF/war-deployers-jboss-beans.xml file.

  |    <bean name="WebAppClusteringDefaultsDeployer" 
  |          class="org.jboss.web.tomcat.service.deployers.ClusteringDefaultsDeployer">
  |       <!-- Default session cache config used by distributable webapps -->
  |       <property name="cacheName">standard-session-cache</property>
  |       <!-- Default session cache config used by FIELD granularity distributable webapps -->      
  |       <property name="fieldGranularityCacheName">field-granularity-session-cache</property>
  |         ....
  |       <property name="replicationGranularity">SESSION</property>
  |      ....
  | </bean>

Change replicationGranularity to FIELD and you'll get FIELD by default, unless you configure something else in the app's jboss-web.xml.

If you want field-granularity-session-cache to be used by default even if you use SESSION or ATTRIBUTE granularity, change the value of the "cacheName" property. Although I'd recommend adding your own cache config or tweaking standard-session-cache to match what you want. Solely because using a config named "field-granularity-..." for non-field-granularity will confuse someone some day. :)

I haven't revamped the FIELD granularity section of the guide yet. :(

The AS now uses the standard POJO Cache annotation instead of @AopMarker. It is @org.jboss.cache.pojo.annotation.Replicable.

Re: using aopc, you can also use load time weaving. See http://www.jboss.org/jbossaop/docs/2.0.0.GA/docs/aspect-framework/reference/en/html/running.html#d0e4254 for some discussion of weaving options. There are a couple details in there that are a bit off from AS 5.1 but it's useful.

Here's a quick summary of what I did to get load-time weaving for a FIELD granularity web app:

1) Edit server/all/conf/bootstrap/aop.xml's AspectManager bean:

  | <property name="enableLoadtimeWeaving">true</property>
  | <property name="include">com.bar., com.bar.</property>
  | <property name="exclude">org.</property>

The first is self-evident. :) The second is where you list the packages you for sure want AOP to look at for load-time weaving. The third is packages for sure *not* to look at. By default that was "org.jboss." but when I experimented I got complaints about some stuff in org.richfaces in the admin-console.war, so I changed it to just "org."

2) Copy the pluggable-instrumentor.jar to the bin/ dir from server/all/deployers/jboss-aop-jboss5.deployer

3) Edit run.conf and add

JAVA_OPTS="$JAVA_OPTS -javaagent:pluggable-instrumentor.jar"

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4237765#4237765

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4237765

More information about the jboss-user mailing list