public abstract class AbstractAsynchronouslyRefreshedCache<T> extends Object implements AsynchronouslyRefreshedCache<T>, RefreshableCacheListener, Callable<Void>, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, TransactionListener
| Constructor and Description |
|---|
AbstractAsynchronouslyRefreshedCache() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterCommit()
Invoked after transaction commit.
|
void |
afterPropertiesSet() |
void |
afterRollback()
Invoked after transaction rollback.
|
void |
beforeCommit(boolean readOnly)
Called before a transaction is committed.
|
void |
beforeCompletion()
Invoked before transaction commit/rollback.
|
void |
broadcastEvent(RefreshableCacheEvent event) |
protected abstract T |
buildCache(String tenantId)
Build the cache entry for the specific tenant.
|
Void |
call() |
void |
flush() |
void |
forceInChangesForThisUncommittedTransaction() |
T |
get()
Get the cache.
|
String |
getCacheId()
Get the cache id
|
void |
init() |
boolean |
isUpToDate()
Determine if the cache is up to date
|
void |
onRefreshableCacheEvent(RefreshableCacheEvent refreshableCacheEvent)
Callback made when a cache refresh occurs
|
void |
refresh()
Refresh the cache asynchronously.
|
void |
register(RefreshableCacheListener listener)
Register to be informed when the cache is updated in the background.
|
void |
setBeanName(String name) |
void |
setRegistry(AsynchronouslyRefreshedCacheRegistry registry) |
void |
setTenantService(org.alfresco.repo.tenant.TenantService tenantService) |
void |
setThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor) |
protected void |
waitForBuild(org.alfresco.repo.cache.AbstractAsynchronouslyRefreshedCache.Refresh refresh) |
public AbstractAsynchronouslyRefreshedCache()
public void register(RefreshableCacheListener listener)
RefreshableCacheregister in interface RefreshableCache<T>public void setThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor)
threadPool - the threadPool to setpublic void setRegistry(AsynchronouslyRefreshedCacheRegistry registry)
registry - the registry to setpublic void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
tenantService - the tenantService to setpublic void init()
public T get()
RefreshableCacheget in interface RefreshableCache<T>public void forceInChangesForThisUncommittedTransaction()
protected void waitForBuild(org.alfresco.repo.cache.AbstractAsynchronouslyRefreshedCache.Refresh refresh)
public void refresh()
RefreshableCacherefresh in interface RefreshableCache<T>public void onRefreshableCacheEvent(RefreshableCacheEvent refreshableCacheEvent)
RefreshableCacheListeneronRefreshableCacheEvent in interface RefreshableCacheListenerpublic boolean isUpToDate()
AsynchronouslyRefreshedCacheisUpToDate in interface AsynchronouslyRefreshedCache<T>public void setBeanName(String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic String getCacheId()
AsynchronouslyRefreshedCachegetCacheId in interface AsynchronouslyRefreshedCache<T>getCacheId in interface RefreshableCacheListenerprotected abstract T buildCache(String tenantId)
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic void broadcastEvent(RefreshableCacheEvent event)
public void flush()
flush in interface TransactionListenerpublic void beforeCommit(boolean readOnly)
TransactionListenerAll transaction resources are still available.
beforeCommit in interface TransactionListenerreadOnly - true if the transaction is read-onlypublic void beforeCompletion()
TransactionListenerTransactionListener.beforeCommit(boolean) even if TransactionListener.beforeCommit(boolean)
failed.
All transaction resources are still available.
beforeCompletion in interface TransactionListenerpublic void afterCommit()
TransactionListenerAny exceptions generated here will only be logged and will have no effect on the state of the transaction.
Although all transaction resources are still available, this method should be used only for cleaning up resources after a commit has occured.
afterCommit in interface TransactionListenerpublic void afterRollback()
TransactionListenerAny exceptions generated here will only be logged and will have no effect on the state of the transaction.
Although all transaction resources are still available, this method should be used only for cleaning up resources after a rollback has occured.
afterRollback in interface TransactionListenerCopyright © 2005–2014 Alfresco Software. All rights reserved.