自己成功使用ehcache集群的总结
jeli007
12年前
总结:其实很简单,毕竟人家做成了产品的东西就不是考你的智商的,代码如下,注意rmi端口冲突问题
<!-- rmi远程cache服务 -->
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
socketTimeoutMillis=2000,
rmiUrls=//10.79.6.172:40000/baseParam" />
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
socketTimeoutMillis=2000,
rmiUrls=//10.79.6.172:40000/baseParam" />
<!-- rmi本地cache服务 -->
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=10.79.6.177, port=40000, socketTimeoutMillis=2000"
/>
<cache name="baseParam"
maxElementsInMemory="1000"
eternal="false"
timeToIdleSeconds="2000"
timeToLiveSeconds="2000"
overflowToDisk="false">
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicatePutsViaCopy=true, replicateUpdates=true,
replicateUpdatesViaCopy=true, replicateRemovals=true,
asynchronousReplicationIntervalMillis=200" />
</cache>
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=10.79.6.177, port=40000, socketTimeoutMillis=2000"
/>
<cache name="baseParam"
maxElementsInMemory="1000"
eternal="false"
timeToIdleSeconds="2000"
timeToLiveSeconds="2000"
overflowToDisk="false">
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicatePutsViaCopy=true, replicateUpdates=true,
replicateUpdatesViaCopy=true, replicateRemovals=true,
asynchronousReplicationIntervalMillis=200" />
</cache>