Package org.alfresco.repo.cache
Class AbstractMTAsynchronouslyRefreshedCache<T>
- java.lang.Object
-
- org.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache<T>
-
- org.alfresco.repo.cache.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
-
-
Constructor Summary
Constructors Constructor Description AbstractMTAsynchronouslyRefreshedCache()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected abstract TbuildCache(java.lang.String tenantId)Build the cache entry for the specific tenant.voidforceInChangesForThisUncommittedTransaction()Tget()Get the cache.booleanisUpToDate()Determine if the cache is up to datevoidrefresh()Refresh the cache asynchronously.voidsetTenantService(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
-
Methods inherited from interface org.alfresco.repo.cache.AsynchronouslyRefreshedCache
getCacheId
-
-
-
-
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:RefreshableCacheGet 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:
getin interfaceRefreshableCache<T>- Returns:
- T
-
forceInChangesForThisUncommittedTransaction
public void forceInChangesForThisUncommittedTransaction()
-
refresh
public void refresh()
Description copied from interface:RefreshableCacheRefresh the cache asynchronously.- Specified by:
refreshin interfaceRefreshableCache<T>
-
isUpToDate
public boolean isUpToDate()
Description copied from interface:AsynchronouslyRefreshedCacheDetermine if the cache is up to date- Specified by:
isUpToDatein interfaceAsynchronouslyRefreshedCache<T>- Returns:
- true if the cache is not currently refreshing itself
-
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:
buildCachein classorg.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache<T>
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classorg.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache<T>- Throws:
java.lang.Exception
-
-