如何在网络出现故障后使ehcache重新连接远程缓存对等体?

时间:2014-09-01 08:42:44

标签: java ehcache

我正在使用ehcache 2.8.2,我注意到我的一个节点无法恢复的问题(我在环境测试中有5个左右)。将日志调低到调试级别我可以看到我得到了

DEBUG  (pool-4-thread-1) rmiUrl is stale. Either the remote peer is shutdown or the network connectivity has been interrupted. Will be removed from list of remote cache peers

几次(每个节点一次),然后记录静默,直到服务器循环。

我认为可能是配置不正确,但我找不到本节的相关文档,而且对我来说并不是很明显我需要配置的内容。

有谁知道配置中如何处理网络恢复?

编辑:

当前配置详情(简化):

Ehcache:

<ehcache>

<diskStore path="/var/patelm5/cache"/>

<cacheManagerEventListenerFactory class="" properties=""/>

<cacheManagerPeerProviderFactory
        class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
        properties="peerDiscovery=automatic,
                    multicastGroupAddress=230.0.0.1,
                    multicastGroupPort=4446"/>

<cacheManagerPeerListenerFactory
        class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>

 <defaultCache maxElementsInMemory="100" eternal="false" timeToIdleSeconds="120"
        timeToLiveSeconds="120"
        overflowToDisk="true"
        diskPersistent="false"
        diskExpiryThreadIntervalSeconds="120"
        memoryStoreEvictionPolicy="LRU"
 />

</ehcache>

Spring.xml

<bean id="availabilityMonitorEhCache" class="org.patelm5.core.spring.ExtendedEhCacheFactoryBean">
    <property name="cacheManager" ref="ehCacheManagerFactory" />
    <property name="cacheName" ref="AVAILABILTY_MONITOR_CACHE_NAME" />
    <property name="maxElementsInMemory" value="1" />
    <property name="eternal" value="false" />
    <property name="overflowToDisk" value="false" />
    <property name="diskPersistent" value="false" />
    <property name="diskExpiryThreadIntervalSeconds" value="300" />
    <property name="timeToLive" value="36000" />
    <property name="timeToIdle" value="36000" />
    <property name="cacheEventListener" ref="defaultCacheEventListener" />
    <property name="bootstrapCacheLoader" ref="bootstrapCacheLoader" />
</bean>

<bean id="bootstrapCacheLoaderFactory" class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" />
<bean id="cacheEventListenerFactory" class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" />

<bean id="bootstrapCacheLoader" factory-bean="bootstrapCacheLoaderFactory" factory-method="createBootstrapCacheLoader">
    <constructor-arg>
        <util:properties>
            <prop key="bootstrapAsynchronously">true</prop>
        </util:properties>
    </constructor-arg>
</bean>

<bean id="cacheEventListener" factory-bean="cacheEventListenerFactory" factory-method="createCacheEventListener">
    <constructor-arg>
        <util:properties>
            <prop key="replicateAsynchronously">false</prop>
        </util:properties>
    </constructor-arg>
</bean>

0 个答案:

没有答案