Hello All, 

 

Region implements two similar methods containsKey and containsKeyOnServer.

We implement a cache client with a client-cache.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<client-cache xmlns=http://geode.apache.org/schema/cache
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

    xsi:schemaLocation="http://geode.apache.org/schema/cache
http://geode.apache.org/schema/cache/cache-1.0.xsd"; 

    version="1.0">

    <pool name="client-pool" subscription-enabled="true">

        <locator host="localhost" port="10334"/>

    </pool>

    <region name="myremoteregion" refid="PROXY"/>    

    <region name="mylocalregion" refid="LOCAL"/>

</client-cache>

 

If we use the method containsKey with the region myremoteregion, we get a
null value and we must use the method containsKeyOnServer. 

On the other side if we use containsKeyOnServer with a local region we get
the exception UnsupportedOperationException
<https://docs.oracle.com/javase/8/docs/api/java/lang/UnsupportedOperationExc
eption.html?is-external=true> 

 

So it is important to determine if a region is local or proxi.

 

I would like to get such code 

 

boolean containsKey;

 

if (my region is proxy) {

   containsKey = region.containsKeyOnServer(key);

} else {

   containsKey = region.containsKey(key);

}

 

Question: Does someone know how can we find out if a region is proxy.

 

Thank you for your help

 

 

Best regards

 

Paul Perez Chief Architect

Pymma Consulting

--------------------------

Tel: +44 79 44 36 04 65 

Skype ID : polperez

 

Reply via email to