cache1.put("k1", "v1");
assert "v1".equals(cache1.get("k1"));
// create a new jgroups channel that will join the cluster
// but without attaching the Infinispan RpcDispatcher
Channel channel2 = createJGroupsChannel(manager(0).getCacheManagerConfiguration());
try {
// try the put operation again
cache1.put("k2", "v2");
assert "v2".equals(cache1.get("k2"));
// create a new cache, make sure it joins properly
ConfigurationBuilder c = getDefaultClusteredCacheConfig(cacheMode, false);
c.clustering().stateTransfer().fetchInMemoryState(true);
EmbeddedCacheManager cm = addClusterEnabledCacheManager(new TransportFlags());
cm.defineConfiguration(cacheName, c.build());
Cache<String, String> cache2 = cm.getCache(cacheName);
assert cache2.getAdvancedCache().getRpcManager().getTransport().getMembers().size() == 3;
assert "v1".equals(cache1.get("k1"));
assert "v2".equals(cache1.get("k2"));
cache1.put("k1", "v1_2");
cache2.put("k2", "v2_2");
assert "v1_2".equals(cache1.get("k1"));
assert "v2_2".equals(cache1.get("k2"));
} finally {
channel2.close();
}
}