It is important to stress that multiple locators for different distributed systems using one pool are not tested or supported. To connect a client to two distributed systems it will need to configure two pools and use different region names in each distributed system that the client connects too. If a client needs to connect to regions with the same name in two different distributed systems then it must close or destroy the region and recreate it with the changed pool configuration each time it wants to change between two distributed systems. If the regions used have different names the client can work with regions from different cluster at the same time.
The following shows a simple client-cache.xml configuration where regions have unique names overall:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE client-cache PUBLIC "-//GemStone Systems, Inc.//GemFire Declarative Cache 7.0//EN" "http://www.gemstone.com/dtd/cache7_0.dtd"> <client-cache> <pool name="CLUSTER1"> <locator port="40001" host="C1H1"/> </pool> <pool name="CLUSTER2"> <locator port="40001" host="C2H1"/> </pool> <region name="Region1C1"> <region-attributes refid="PROXY" pool-name="CLUSTER1"/> </region> <region name="Region1C2"> <region-attributes refid="PROXY" pool-name="CLUSTER2"/> </region> </client-cache>
Using this configuration it is possible to work with Region1C1 and Region1C2 without noticing that they are located in different distributed systems.
In the case that you need to work with two regions located in two different distributed systems and these two regions have the same name you will either need to use two different cache.xml files or do the setup dynamically in the code. The important thing to remember is to not work with the two regions simultaneously as previously described in this article.