{
Configuration cacheCfg = new Configuration();
cacheCfg.setCacheMode(Configuration.CacheMode.REPL_SYNC);
cacheCfg.setFetchInMemoryState(false);
cache1 = new DefaultCacheFactory().createCache(cacheCfg.clone());
searchableCache1 = new SearchableCacheFactory().createSearchableCache(cache1, Person.class);
cache2 = new DefaultCacheFactory().createCache(cacheCfg.clone());
searchableCache2 = new SearchableCacheFactory().createSearchableCache(cache2, Person.class);
// wait until both caches are started and can see each other on the network.
long giveUpTime = System.currentTimeMillis() + (60 * 1000); // give up after 1 minute of waiting
boolean wait = true;
while (wait && System.currentTimeMillis() < giveUpTime)