Using RMI for Replicated Caching
Replicated caching using RMI is desirable because:
![*](bullet.gif)
RMI is the default remoting mechanism in Java
![*](bullet.gif)
it allows tuning of TCP socket options
![*](bullet.gif)
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
![*](bullet.gif)
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:
![*](bullet.gif)
a PeerProvider
![*](bullet.gif)
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.