1 2 Previous Next 15 Replies Latest reply on Mar 27, 2012 1:07 PM by rahulgagrani Go to original post
      • 15. Re: Infinispan, JBoss AS 7.1.1.Final in domain mode: empty cache!
        rahulgagrani

        That had something to do with jboss setup on my windows machine.

         

        Tested successfully with  AS 7.1.1Final in domain mode. Below are the details:

         

        domain.xml entry

        <cache-container name="mycachecontainer" default-cache="my-cache" jndi-name="java:jboss/infinispan/mycachecontainer">

            <transport lock-timeout="60000"/>

            <distributed-cache name="my-cache" owners="2" mode="ASYNC" start="EAGER"/>

        </cache-container>

         

         

        Java code:

        private static org.infinispan.manager.EmbeddedCacheManager container = null;

         

        javax.naming.Context context = new javax.naming.InitialContext();

        container = (org.infinispan.manager.EmbeddedCacheManager)context.lookup("java:jboss/infinispan/mycachecontainer");

         

        AdvancedCache<Object, Object> cache = container.getCache("my-cache").getAdvancedCache().with(this.getClass().getClassLoader());

        System.out.println("Reading the cache firstName from cache: " + cache.get("firstName"));

        System.out.println("updating the cache...");

        cache.put("firstName", requestMap.get("firstName"));

        System.out.println("cache updated.");

        System.out.println("Reading the cache - firstName" + cache.get("firstName"));

         

         

        Paul thanks for your pointer on the start="EAGER" attribute, I actualled faced that issue yesterday due to lazy initialization nature of the infinispan cache.

        1 2 Previous Next