Class AbstractMTAsynchronouslyRefreshedCache<T>

  • All Implemented Interfaces:
    java.util.concurrent.Callable<java.lang.Void>, AsynchronouslyRefreshedCache<T>, RefreshableCache<T>, org.alfresco.util.cache.AsynchronouslyRefreshedCache<T>, org.alfresco.util.cache.RefreshableCache<T>, org.alfresco.util.cache.RefreshableCacheListener, org.alfresco.util.transaction.TransactionListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean
    Direct Known Subclasses:
    AuthorityBridgeTableAsynchronouslyRefreshedCache, ConfigDataCache

    public abstract class AbstractMTAsynchronouslyRefreshedCache<T>
    extends org.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache<T>
    implements AsynchronouslyRefreshedCache<T>, org.springframework.beans.factory.InitializingBean
    The base implementation for Multi-tenant asynchronously refreshed cache. Currently supports one value per tenant. Implementors just need to provide buildCache(String tennantId)
    Since:
    4.1.3
    Author:
    Andy
    • Field Summary

      • Fields inherited from class org.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache

        live, liveLock
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void afterPropertiesSet()  
      protected abstract T buildCache​(java.lang.String tenantId)
      Build the cache entry for the specific tenant.
      void forceInChangesForThisUncommittedTransaction()  
      T get()
      Get the cache.
      boolean isUpToDate()
      Determine if the cache is up to date
      void refresh()
      Refresh the cache asynchronously.
      void setTenantService​(org.alfresco.repo.tenant.TenantService tenantService)  
      • Methods inherited from class org.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache

        afterCommit, afterRollback, beforeCommit, beforeCompletion, broadcastEvent, call, forceInChangesForThisUncommittedTransaction, get, getCacheId, init, isUpToDate, onRefreshableCacheEvent, refresh, register, setBeanName, setRegistry, setThreadPoolExecutor, toString, waitForBuild
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractMTAsynchronouslyRefreshedCache

        public AbstractMTAsynchronouslyRefreshedCache()
    • Method Detail

      • setTenantService

        public void setTenantService​(org.alfresco.repo.tenant.TenantService tenantService)
        Parameters:
        tenantService - the tenantService to set
      • get

        public T get()
        Description copied from interface: RefreshableCache
        Get the cache. If there is no cache value this call will block. If the underlying cache is being refreshed, the old cache value will be returned until the refresh is complete.
        Specified by:
        get in interface RefreshableCache<T>
        Returns:
        T
      • forceInChangesForThisUncommittedTransaction

        public void forceInChangesForThisUncommittedTransaction()
      • buildCache

        protected abstract T buildCache​(java.lang.String tenantId)
        Build the cache entry for the specific tenant. This method is called in a thread-safe manner i.e. it is only ever called by a single thread.
        Specified by:
        buildCache in class org.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache<T>
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Overrides:
        afterPropertiesSet in class org.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache<T>
        Throws:
        java.lang.Exception