我正在使用EhCache 1.4.0, Spring 3.0.5,在使用JRE 1.6在Tomcat 6的网络应用中。 我通过JMX揭露了L2的切身管理。
<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
<property name="locateExistingServerIfPossible" value="true" />
</bean>
<util:property-path id="hibernateCacheProvider" path="sessionFactory.settings.cacheProvider" />
<bean id="hibernateEhCacheManager" class="com.mycompany.spring.beans.factory.config.UnaccessibleFieldRetrievingFactoryBean">
<property name="targetObject" ref="hibernateCacheProvider" />
<property name="targetField" value="manager" />
<property name="makeInstanceFieldVisible" value="true" />
</bean>
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<description>The cacheManager configuration.</description>
<property name="targetClass" value="net.sf.ehcache.management.ManagementService" />
<property name="staticMethod" value="net.sf.ehcache.management.ManagementService.registerMBeans" />
<property name="arguments">
<list>
<ref bean="hibernateEhCacheManager" />
<ref bean="mbeanServer" />
<value type="boolean">true</value>
<value type="boolean">true</value>
<value type="boolean">true</value>
<value type="boolean">true</value>
</list>
</property>
</bean>
<bean class="org.springframework.jmx.export.annotation.AnnotationMBeanExporter">
<property name="server" ref="mbeanServer" />
<property name="beans">
<map>
<entry key="Hibernate:type=statistics,application=applicationOne">
<bean class="org.hibernate.jmx.StatisticsService">
<property name="statisticsEnabled" value="true" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</entry>
</map>
</property>
</bean>
<bean id="hbm.properties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.generate_statistics">false</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">applicationOne-web/ehcache.xml</prop>
<prop key="hibernate.cache.query_cache_factory">org.hibernate.cache.StandardQueryCacheFactory</prop>
</props>
</property>
</bean>
我必须允许通过使用jmxterm来清除L2中的所有条目。 工具:
run --bean net.sf.ehcache:type=CacheManager,name=net.sf.ehcache.CacheManager@605df3c5 clearAll
我知道,以确定从该背景来看准确的<代码>CacheManager,但出于某种原因,我无法使用。
迄今为止,尽管如此,但据推测,我的核查和测验仪(Tomcat服务器)有2份应用,同时允许对EhCache进行联合测验。 这两项甲基溴名称如下:
net.sf.ehcache:type=CacheManager,name=net.sf.ehcache.CacheManager@605df3c5
net.sf.ehcache:type=CacheManager,name=net.sf.ehcache.CacheManager@49ff3459
你们可以看到,在试图确定哪些切身之处时,它们并不有用。
因此,我的问题是:是否有可能确定每个CacheManager的名字,以便确定究竟用什么来清除L2藏匿点的所有条目?
Thank you.