In our use case, we'd like to use two Caches. Some nodes would start both caches, while some nodes only starts one of the caches. We tried to define both Caches under one CacheManager. Assume one cache is called "cache1", and the other is called "cache2". On node1, we only called cacheManager.getCache("cache1") WITHOUT calling cacheManager.getCache("cache2"). On node2, we got both caches, and tried to put data into cache2. Even though node1 didn't start cache2, the nodes2 still tried to replicate data to node1, so we got two different exceptions in 2 scenarios - if node1 doesn't load the data class for cache2 at all, it got ClassNotFound exception; otherwise, it got ReplicationTimeout exception. While using asynchronous comm wouldn't cause the exception, it's undesirable for our use case as we can't tell an error immediately.
Is there a way to make our use case work under only one CacheManager? Or we have to use 2 CacheManagers?
The cache managers need to be symmetrical. CacheManager1 should have the same caches as CacheManager2.