Using RMI for Replicated Caching
Replicated caching using RMI is desirable because:
RMI is the default remoting mechanism in Java
it allows tuning of TCP socket options
Element keys and values for disk storage must already be Serializable, therefore directly transmittable over RMI without the need for conversion to a third format such as XML
it can be configured to pass through firewalls
While RMI is a point-to-point protocol, which can generate a lot of network traffic, Ehcache manages this through batching of communications for the asynchronous replicator.
To set up replicated caching with RMI you need to configure the CacheManager with:
a PeerProvider
a CacheManagerPeerListener
For each cache that will be replicated, you then need to add one of the RMI cacheEventListener types to propagate messages. You can also optionally configure a cache to bootstrap from other caches in the cluster.