Search in sources :

Example 1 with DefaultAsynchronouslyRefreshedCacheRegistry

use of org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry in project alfresco-repository by Alfresco.

the class MTPolicyComponentTest method initDictionaryCaches.

@SuppressWarnings("unchecked")
private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception {
    CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
    compiledModelsCache.setDictionaryDAO(dictionaryDAO);
    compiledModelsCache.setTenantService(tenantService);
    compiledModelsCache.setRegistry(new DefaultAsynchronouslyRefreshedCacheRegistry());
    ThreadPoolExecutorFactoryBean threadPoolfactory = new ThreadPoolExecutorFactoryBean();
    threadPoolfactory.afterPropertiesSet();
    compiledModelsCache.setThreadPoolExecutor((ThreadPoolExecutor) threadPoolfactory.getObject());
    dictionaryDAO.setDictionaryRegistryCache(compiledModelsCache);
    dictionaryDAO.init();
}
Also used : DefaultAsynchronouslyRefreshedCacheRegistry(org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry) ThreadPoolExecutorFactoryBean(org.alfresco.util.ThreadPoolExecutorFactoryBean) CompiledModelsCache(org.alfresco.repo.dictionary.CompiledModelsCache)

Example 2 with DefaultAsynchronouslyRefreshedCacheRegistry

use of org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry in project alfresco-repository by Alfresco.

the class TestModel method initDictionaryCaches.

private static void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception {
    CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
    compiledModelsCache.setDictionaryDAO(dictionaryDAO);
    compiledModelsCache.setTenantService(tenantService);
    compiledModelsCache.setRegistry(new DefaultAsynchronouslyRefreshedCacheRegistry());
    ThreadPoolExecutorFactoryBean threadPoolfactory = new ThreadPoolExecutorFactoryBean();
    threadPoolfactory.afterPropertiesSet();
    compiledModelsCache.setThreadPoolExecutor((ThreadPoolExecutor) threadPoolfactory.getObject());
    dictionaryDAO.setDictionaryRegistryCache(compiledModelsCache);
    dictionaryDAO.init();
}
Also used : DefaultAsynchronouslyRefreshedCacheRegistry(org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry) ThreadPoolExecutorFactoryBean(org.alfresco.util.ThreadPoolExecutorFactoryBean)

Example 3 with DefaultAsynchronouslyRefreshedCacheRegistry

use of org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry in project alfresco-repository by Alfresco.

the class DictionaryDAOTest method initDictionaryCaches.

private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception {
    CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
    compiledModelsCache.setDictionaryDAO(dictionaryDAO);
    compiledModelsCache.setTenantService(tenantService);
    compiledModelsCache.setRegistry(new DefaultAsynchronouslyRefreshedCacheRegistry());
    ThreadPoolExecutorFactoryBean threadPoolfactory = new ThreadPoolExecutorFactoryBean();
    threadPoolfactory.afterPropertiesSet();
    compiledModelsCache.setThreadPoolExecutor((ThreadPoolExecutor) threadPoolfactory.getObject());
    dictionaryDAO.setDictionaryRegistryCache(compiledModelsCache);
    dictionaryDAO.init();
}
Also used : DefaultAsynchronouslyRefreshedCacheRegistry(org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry) ThreadPoolExecutorFactoryBean(org.alfresco.util.ThreadPoolExecutorFactoryBean)

Example 4 with DefaultAsynchronouslyRefreshedCacheRegistry

use of org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry in project alfresco-repository by Alfresco.

the class DictionaryLoadDAOTest method initDictionaryCaches.

private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception {
    CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
    compiledModelsCache.setDictionaryDAO(dictionaryDAO);
    compiledModelsCache.setTenantService(tenantService);
    compiledModelsCache.setRegistry(new DefaultAsynchronouslyRefreshedCacheRegistry());
    TraceableThreadFactory threadFactory = new TraceableThreadFactory();
    threadFactory.setThreadDaemon(true);
    threadFactory.setThreadPriority(Thread.NORM_PRIORITY);
    ThreadPoolExecutor threadPoolExecutor = new DynamicallySizedThreadPoolExecutor(20, 20, 90, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), threadFactory, new ThreadPoolExecutor.CallerRunsPolicy());
    compiledModelsCache.setThreadPoolExecutor(threadPoolExecutor);
    dictionaryDAO.setDictionaryRegistryCache(compiledModelsCache);
    dictionaryDAO.init();
}
Also used : DynamicallySizedThreadPoolExecutor(org.alfresco.util.DynamicallySizedThreadPoolExecutor) DefaultAsynchronouslyRefreshedCacheRegistry(org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry) TraceableThreadFactory(org.alfresco.util.TraceableThreadFactory) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) DynamicallySizedThreadPoolExecutor(org.alfresco.util.DynamicallySizedThreadPoolExecutor)

Example 5 with DefaultAsynchronouslyRefreshedCacheRegistry

use of org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry in project alfresco-repository by Alfresco.

the class RepoDictionaryDAOTest method initDictionaryCaches.

private void initDictionaryCaches(DictionaryDAOImpl dictionaryDAO, TenantService tenantService) throws Exception {
    CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
    compiledModelsCache.setDictionaryDAO(dictionaryDAO);
    compiledModelsCache.setTenantService(tenantService);
    compiledModelsCache.setRegistry(new DefaultAsynchronouslyRefreshedCacheRegistry());
    ThreadPoolExecutorFactoryBean threadPoolfactory = new ThreadPoolExecutorFactoryBean();
    threadPoolfactory.afterPropertiesSet();
    compiledModelsCache.setThreadPoolExecutor((ThreadPoolExecutor) threadPoolfactory.getObject());
    dictionaryDAO.setDictionaryRegistryCache(compiledModelsCache);
    dictionaryDAO.init();
}
Also used : DefaultAsynchronouslyRefreshedCacheRegistry(org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry) ThreadPoolExecutorFactoryBean(org.alfresco.util.ThreadPoolExecutorFactoryBean)

Aggregations

DefaultAsynchronouslyRefreshedCacheRegistry (org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry)6 ThreadPoolExecutorFactoryBean (org.alfresco.util.ThreadPoolExecutorFactoryBean)5 CompiledModelsCache (org.alfresco.repo.dictionary.CompiledModelsCache)2 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 DynamicallySizedThreadPoolExecutor (org.alfresco.util.DynamicallySizedThreadPoolExecutor)1 TraceableThreadFactory (org.alfresco.util.TraceableThreadFactory)1