Infinispan Cache Distribution-Asynchronous Mode Issue

Latest response

Hi,

We are using infinispan in Distributed(Asynchronous) mode with 2-nodes. I am able to put a key in the cache but not able to read it immediately its returning null (Probably next statement).I tried in 2-ways

1-way

Cache<String, String> cache = getCacheManager().getCache("Demo");
cache.put("key-1", "value-1");
System.out.println("Value for Key-1 : "+cache.get("key-1")); // This is Returning NULL in Asynchronous Mode

2-way

Cache<String, String> cache = getCacheManager().getCache("Demo");
NotifyingFuture f1= cache.putAsync("key-1", "value-1");
try
{
f1.get();
}
catch(Exception e)
{
System.out.println("Excep occured: "+e);
}
System.out.println("Value for Key-1 : "+cache.get("key-1")); // This is Returning NULL in Asynchronous Mode

Cache Config XML

<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="urn:infinispan:config:5.2">
  <global>
  <transport clusterName="infinispan-cluster">
  <properties>
  <property name="configurationFile" value="jgroups.xml" />
  </properties>
  </transport>
  </global>
  <default>
  <!-- Configure a Asynchronous replication cache -->
  <clustering mode="distribution">
      <async asyncMarshalling="false" useReplQueue="false"/>           
          <l1 enabled="false" />
          <hash numOwners="2" numSegments="20" />
  </clustering>
  </default>
  </infinispan>

Looking forward for suggestions and help.

Regards,
Vadivel

Responses