private Cache<String, ConfluenceDavSession> getSessionCache() { return cacheManager.getCache(CACHE_KEY); }
public void start() { this.activeWorkflowCache = cacheManager.getCachedReference(WORKFLOW_CACHE_NAME, new WorkflowSupplier()); this.workflowSchemeEntityCache = cacheManager.getCache(ENTITY_CACHE_NAME, new WorkflowSchemeEntitySupplier()); eventPublisher.register(this); }
private List<CacheStatisticsAnalyticEvent> getCacheStatistics() { return cacheManager.getManagedCaches().stream() .filter(ManagedCache::isStatisticsEnabled) .map(cache -> new CacheStatisticsAnalyticEvent(cache.getName(), calculateStatistics(cache))) .collect(toList()); }
private CachedReference<List<Directory>> buildReference(final CacheManager cacheManager) { return cacheManager.getCachedReference(OfBizDirectoryDao.class, "directoryCache", new Supplier<List<Directory>>() { @Override public List<Directory> get() { // This is already an Immutable List return getAllDirectories(); } }); }
private long getProperty(CacheStatisticsKey propertyName, long defaultValue) { if(cacheManager.getManagedCache(cacheName) == null || cacheManager.getManagedCache(cacheName).getStatistics().get(propertyName) == null) { return defaultValue; } return cacheManager.getManagedCache(cacheName).getStatistics().get(propertyName).get(); } }
@Override @ClusterSafe ("This is a local node instance behaviour.") public synchronized void activate() throws ClusterStateException { final Node currentNode = getNode(); final String nodeId = requireNodeId(currentNode); LOG.info("Activating cluster instance: '" + nodeId + '\''); eventPublisher.publish(NodeActivatingEvent.INSTANCE); updateState(currentNode, ACTIVATING); nodeRef.reset(); eventPublisher.publish(ClearCacheEvent.INSTANCE); cacheManager.flushCaches(); startServices(); updateState(currentNode, ACTIVE); eventPublisher.publish(NodeActivatedEvent.INSTANCE); LOG.info("Activated cluster instance: '" + currentNode.getNodeId() + '\''); }
private CachedReference<List<Application>> buildReference(final CacheManager cacheManager) { return cacheManager.getCachedReference(OfBizApplicationDao.class, "applicationCache", new Supplier<List<Application>>() { @Override public List<Application> get() { // This is already an Immutable List return getAllApplications(); } }); }
@Override Cache<DirectoryEntityKey, OfBizUser> createCache() { return cacheManager.getCache(EagerOfBizUserCache.class.getName() + ".userCache", null, USER_CACHE_SETTINGS); }
public CachingProjectRoleAndActorStore(final ProjectRoleAndActorStore delegate, final RoleActorFactory roleActorFactory, final CacheManager cacheManager) { this.delegate = delegate; this.roleActorFactory = roleActorFactory; this.projectRoles = cacheManager.getCachedReference(getClass(), "projectRoles", new AllProjectRolesLoader()); this.defaultRoleActors = cacheManager.getCache(getClass().getName() + ".defaultRoleActors", new DefaultRoleActorsLoader()); this.projectRoleActors = cacheManager.getCache(getClass().getName() + ".projectRoleActors", new ProjectRoleActorsLoader(), new CacheSettingsBuilder().expireAfterAccess(30, TimeUnit.MINUTES).build()); }
public DefaultEventTypeManager(OfBizDelegator delegator, WorkflowManager workflowManager, NotificationSchemeManager notificationSchemeManager, CacheManager cacheManager) { this.delegator = delegator; this.workflowManager = workflowManager; this.notificationSchemeManager = notificationSchemeManager; eventTypesMapRef = cacheManager.getCachedReference(DefaultEventTypeManager.class, "eventTypesMapRef", new Supplier<Map<Long, EventType>>() { @Override public Map<Long, EventType> get() { return loadEventTypesMap(); } }); }
@SuppressWarnings("ObjectAllocationInLoop") private void collectCacheInstruments(SortedSet<Instrument> sortedInstruments) { for (final ManagedCache cache : cacheManager.getManagedCaches()) { sortedInstruments.addAll(new ManagedCacheInstruments(cache).getInstruments()); } }
@Override public Cache<DirectoryEntityKey,OfBizGroup> createCache() { return cacheManager.getCache(EagerOfBizGroupCache.class.getName() + ".groupCache", null, GROUP_CACHE_SETTINGS); }
public CachingWorkflowDescriptorStore(final WorkflowDescriptorStore delegate, final CacheManager cacheManager) { this.delegate = delegate; workflowCache = cacheManager.getCache(CachingWorkflowDescriptorStore.class.getName() + ".workflowCache", new WorkflowCacheLoader(), new CacheSettingsBuilder().expireAfterAccess(30, TimeUnit.MINUTES).build()); allNamesCache = cacheManager.getCachedReference(CachingWorkflowDescriptorStore.class.getName() + ".allNamesCache", new AllNamesSupplier()); }
public CachingTrustedApplicationStore(final TrustedApplicationStore delegate, final CacheManager cacheManager) { this.delegate = delegate; cache = cacheManager.getCachedReference(getClass(), "cache", new Supplier<Cache>() { @Override public Cache get() { return new Cache(delegate.getAll()); } }); }
/** * Enables collecting JMX metrics. * <p> * Note: it must be called to allow the method <code>registerMBean</code> registering MBeans. *</p> * * @param mbeanServer {@link MBeanServer} instance used for registering and unregistering MBeans * @param cacheManager {@link CacheManager} instance used for retrieving caches metrics */ public void enableCollectingJMXMetrics(@Nonnull MBeanServer mbeanServer, @Nonnull CacheManager cacheManager) { this.mbeanServer = mbeanServer; this.cacheManager = cacheManager; Collection<ManagedCache> caches = cacheManager.getManagedCaches(); for(ManagedCache cache: caches) { registerMBean(cache.getName()); } }
private Cache getSortingSettingsCache() { return cacheManager.getCache(getClass().getName()); }
public CachingVersionStore(final VersionStore delegate, final CacheManager cacheManager) versionById = cacheManager.getCache(getCacheReferenceName("versionById"), new CacheLoader<Long, Optional<Version>>() allVersions = cacheManager.getCachedReference(getCacheReferenceName("allVersions"), new Supplier<List<Version>>() versionsByName = cacheManager.getCache(getCacheReferenceName("versionsByName"), new CacheLoader<String, List<Version>>() versionsByProjectId = cacheManager.getCache(getCacheReferenceName("versionsByProjectId"), new CacheLoader<Long, List<Version>>()
public CachingTrustedApplicationManager(final TrustedApplicationManager delegate, final CacheManager cacheManager) { this.delegate = delegate; cache = cacheManager.getCachedReference(getClass(), "cache", new Supplier<Cache>() { @Override public Cache get() { return new Cache(delegate.getAll()); } } ); }
private Cache<String, Set<String>> getLoggedInUsersCache() { return cacheManager.getCache(getClass().getName()); }
public CachingFieldScreenStore(FieldScreenStore decoratedStore, CacheManager cacheManager) { this.decoratedStore = decoratedStore; allScreensCache = cacheManager.getCachedReference("com.atlassian.jira.issue.fields.screen.CachingFieldScreenStore.allScreensCache", new AllScreenSupplier()); fieldScreenCache = cacheManager.getCache("com.atlassian.jira.issue.fields.screen.CachingFieldScreenStore.fieldScreenCache", new FieldScreenCacheLoader(), new CacheSettingsBuilder().expireAfterAccess(30, TimeUnit.MINUTES).build()); }