How do I verify that EHCache's multicast auto-discovery cache-replication is working?
I've set up EHCache with its stock suggestion on how to set up multicast:
<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
propert开发者_运维问答ies="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, multicastGroupPort=4446"/>
<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="port=40001, socketTimeoutMillis=2000"/>
Then I fire my app up on two machines. How can I see whether they discover one-another and invalidate one-anothers caches?
Cheers
Nik
Have you tried to look at any logging produced by EhCache? This would seem like a good place to start.
It seems that just enabling this does not make the caches distributed. For each cache, add something like the following:
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true"/>
<bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>
Then it starts ticking just fine.
精彩评论