2 Replies Latest reply on Oct 24, 2014 8:20 AM by ges

    AtomicHashMap & Filesystem based cache stores.

    ges

      Hi,

      I'm trying to understand how atomicmaps & cache stores work. I've configured an async SingleFileCacheStore for a cache and are using AtomicMaps against this cache.

       

      AtomicMapLookup.getFineGrainedAtomicMap(cache, key);

       

      All my values are stored in the atomic map. This is how it is:

      k1 -> k2 -> v

      k1 is the key to the cache and k2 is the key to the AtomicMap.

      What I find is that data never makes it to the Single File Cache Store. If I make the cache store write through (synchronous), then it makes it to the cache store.

       

      I think I'm missing something critical here but I'm not sure what it is.

       

      Thanks for your help.

       

      Gesly

        • 1. Re: AtomicHashMap & Filesystem based cache stores.
          wdfink

          I don't understand your example could you show the code how you put/get the values?

          • 2. Re: AtomicHashMap & Filesystem based cache stores.
            ges

            javascript:;final FineGrainedAtomicMap<K, V> am = AtomicMapLookup.getFineGrainedAtomicMap(cache, key);

            am.put(amKey, amValue);

             

            I've tried the above and also the code below.

             

            final TransactionManager tm = cache.getAdvancedCache().getTransactionManager();

            try {

               tm.begin();

            final FineGrainedAtomicMap<K, V> am = AtomicMapLookup.getFineGrainedAtomicMap(cache, key);

              am.put(amKey, amValue);

               tm.commit();

            } catch (NotSupportedException | SystemException | RollbackException | HeuristicRollbackException| HeuristicMixedException e) {

               e.printStackTrace();

            }

             

            This the my configuration for the cache:

            final ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.transaction().transactionManagerLookup(new JBossStandaloneJTAManagerLookup()).persistence()..addSingleFileStore().ignoreModifications(false).async().enable().threadPoolSize(30).modificationQueueSize(1000000).preload(false);

             

            The data is available in the cache and can be queried but it does not get persisted into the store.