Class CacheStoreBalancingWrapper<K,​V>

  • All Implemented Interfaces:
    javax.cache.integration.CacheLoader<K,​V>, javax.cache.integration.CacheWriter<K,​V>, CacheStore<K,​V>

    public class CacheStoreBalancingWrapper<K,​V>
    extends Object
    implements CacheStore<K,​V>
    Cache store wrapper that ensures that there will be no more that one thread loading value from underlying store.
    • Field Detail

      • DFLT_LOAD_ALL_THRESHOLD

        public static final int DFLT_LOAD_ALL_THRESHOLD
        See Also:
        Constant Field Values
    • Constructor Detail

      • CacheStoreBalancingWrapper

        public CacheStoreBalancingWrapper​(CacheStore<K,​V> delegate)
        Parameters:
        delegate - Delegate store.
      • CacheStoreBalancingWrapper

        public CacheStoreBalancingWrapper​(CacheStore<K,​V> delegate,
                                          int loadAllThreshold)
        Parameters:
        delegate - Delegate store.
        loadAllThreshold - Load all threshold.
    • Method Detail

      • loadAllThreshold

        public int loadAllThreshold()
        Returns:
        Load all threshold.
      • load

        @Nullable
        public V load​(K key)
        Specified by:
        load in interface javax.cache.integration.CacheLoader<K,​V>
      • loadAll

        public Map<K,​V> loadAll​(Iterable<? extends K> keys)
                               throws javax.cache.integration.CacheLoaderException
        Specified by:
        loadAll in interface javax.cache.integration.CacheLoader<K,​V>
        Throws:
        javax.cache.integration.CacheLoaderException
      • loadAll

        public void loadAll​(Collection<? extends K> keys,
                            IgniteBiInClosure<K,​V> c)
        Parameters:
        keys - Keys to load.
        c - Closure for loaded values.
      • write

        public void write​(javax.cache.Cache.Entry<? extends K,​? extends V> entry)
        Specified by:
        write in interface javax.cache.integration.CacheWriter<K,​V>
      • writeAll

        public void writeAll​(Collection<javax.cache.Cache.Entry<? extends K,​? extends V>> entries)
        Specified by:
        writeAll in interface javax.cache.integration.CacheWriter<K,​V>
      • delete

        public void delete​(Object key)
                    throws javax.cache.integration.CacheWriterException
        Specified by:
        delete in interface javax.cache.integration.CacheWriter<K,​V>
        Throws:
        javax.cache.integration.CacheWriterException
      • deleteAll

        public void deleteAll​(Collection<?> keys)
                       throws javax.cache.integration.CacheWriterException
        Specified by:
        deleteAll in interface javax.cache.integration.CacheWriter<K,​V>
        Throws:
        javax.cache.integration.CacheWriterException
      • sessionEnd

        public void sessionEnd​(boolean commit)
        Tells store to commit or rollback a transaction depending on the value of the 'commit' parameter.
        Specified by:
        sessionEnd in interface CacheStore<K,​V>
        Parameters:
        commit - True if transaction should commit, false for rollback.