1 Reply Latest reply on Aug 2, 2017 4:22 AM by Dan Berindei

    Wildfly 10.1.0 Final and infinispan Cache problem sync

    Romain BELFILS Newbie

      Hello,

      i have some problems with cache and cluster mode (UDP) Wildfly 10.1.0Final :

       

      standalone-ha.xml:

       

      <cache-container name="replicated_cache" default-cache="default" module="org.wildfly.clustering.server"  jndi-name="infinispan/replicated_cache">
           <transport lock-timeout="60000"/>
           <replicated-cache name="default" mode="SYNC" jndi-name="infinispan/replicated_cache/hemisCache">
                <transaction locking="OPTIMISTIC" mode="FULL_XA"/>
                <eviction strategy="NONE"/>
           </replicated-cache>
           <replicated-cache name="listKernels" mode="SYNC" jndi-name="infinispan/replicated_cache/listKernels">
                <transaction locking="OPTIMISTIC" mode="FULL_XA"/>
                <eviction strategy="NONE"/>
           </replicated-cache>
           <replicated-cache name="containersAvailableKernels" mode="SYNC" jndi-name="infinispan/replicated_cache/containersAvailableKernels">
                <transaction locking="OPTIMISTIC" mode="FULL_XA"/>
                <eviction strategy="NONE"/>
           </replicated-cache>
           <replicated-cache name="containersKernels" mode="SYNC" jndi-name="infinispan/replicated_cache/containersKernels">
                <transaction locking="OPTIMISTIC" mode="FULL_XA"/>
                <eviction strategy="NONE"/>
           </replicated-cache>
           <replicated-cache name="containersByProfile" mode="SYNC" jndi-name="infinispan/replicated_cache/containersByProfile">
                <transaction locking="OPTIMISTIC" mode="FULL_XA"/>
                <eviction strategy="NONE"/>
           </replicated-cache>
           <replicated-cache name="containers" mode="SYNC" jndi-name="infinispan/replicated_cache/containers">
                <transaction locking="OPTIMISTIC" mode="FULL_XA"/>
                <eviction strategy="NONE"/>
           </replicated-cache>
      
      </cache-container>
      

       

      i declare in my singleton :

       

      Head Class singleton :

      @Singleton
      @ConcurrencyManagement(ConcurrencyManagementType.CONTAINER)
      @Lock(LockType.READ)
      @AccessTimeout(Constant.ACCESS_TOKEN_TIMEAOUT)
      @Startup
      public class KernelsManagerSingleton extends AbstractObjectManagement<Kernel>
      {
      ....
      @Resource(lookup = "java:jboss/infinispan/replicated_cache/containersAvailableKernels")
      Cache<String, TreeSet<Kernel>> containersAvailableKernels;
      
      
      ...
      
      
      //Method put some items in cache :
      if (!containersByProfile.containsKey(container.getContainerProfile().getId()))
      {
           containersByProfile.put(container.getContainerProfile().getId(), new HashSet<String>());
      }
      
      
      

       

      Résult :

       

      My cache never sync correctly !

       

      have a an idea ?

       

      is infinispan can Cache a complex structure as TreeSet<Kernel> ?

      Kernel is an Entity Hibernate(JPA).

       

      thx a lot for your help.

       

      Romain.