Management of EHCache

Talend ESB Mediation Developer Guide

EnrichVersion
6.2
EnrichProdName
Talend ESB
task
Design and Development
Installation and Upgrade
EnrichPlatform
Talend ESB

EHCache has its own statistics and management from JMX.

Here's a snippet on how to expose them via JMX in a Spring application context:

<bean id="ehCacheManagementService" 
   class="net.sf.ehcache.management.ManagementService" 
   init-method="init" lazy-init="false">
   <constructor-arg>
      <bean class="net.sf.ehcache.CacheManager" 
         factory-method="getInstance"/>
   </constructor-arg>
   <constructor-arg>
      <bean class="org.springframework.jmx.support.JmxUtils" 
         factory-method="locateMBeanServer"/>
   </constructor-arg>
   <constructor-arg value="true"/>
   <constructor-arg value="true"/>
   <constructor-arg value="true"/>
   <constructor-arg value="true"/>
</bean>

Of course the same thing can be done in straight Java:

ManagementService.registerMBeans(CacheManager.getInstance(), 
   mbeanServer, true, true, true, true);

You can get cache hits, misses, in-memory hits, disk hits, size stats this way. You can also change CacheConfiguration parameters on the fly.