@SuppressWarnings("unchecked") private OperationStatistic<StoreOperationOutcomes.ExpirationOutcome> getExpirationStatistic(Store<?, ?> store) { StatisticsManager statisticsManager = new StatisticsManager(); statisticsManager.root(store); TreeNode treeNode = statisticsManager.queryForSingleton(QueryBuilder.queryBuilder() .descendants() .filter(org.terracotta.context.query.Matchers.context( org.terracotta.context.query.Matchers.allOf(org.terracotta.context.query.Matchers.identifier(org.terracotta.context.query.Matchers .subclassOf(OperationStatistic.class)), org.terracotta.context.query.Matchers.attributes(org.terracotta.context.query.Matchers.hasAttribute("name", "expiration"))))) .build()); return (OperationStatistic<StoreOperationOutcomes.ExpirationOutcome>) treeNode.getContext().attributes().get("this"); }
/** * Instantiates a new statistics placeholder. * * @param ehcache the ehcache * @param executor the executor */ public StatisticsGateway(Ehcache ehcache, ScheduledExecutorService executor) { StatisticsManager statsManager = new StatisticsManager(); statsManager.root(ehcache); this.assocCacheName = ehcache.getName(); ManagementRESTServiceConfiguration mRest = null; if (ehcache != null && ehcache.getCacheManager() != null && ehcache.getCacheManager().getConfiguration() != null) { mRest = ehcache.getCacheManager().getConfiguration().getManagementRESTService(); } this.extended = new ExtendedStatisticsImpl(statsManager, executor, DEFAULT_TIME_TO_DISABLE_MINS, TimeUnit.MINUTES, getProperSampleHistorySize(mRest), getProperSampleIntervalSeconds(mRest), getProperSampleSearchIntervalSeconds(mRest)); this.core = new CoreStatisticsImpl(extended); }
/** * Instantiates a new statistics placeholder. * * @param ehcache the ehcache * @param executor the executor */ public StatisticsGateway(Ehcache ehcache, ScheduledExecutorService executor) { StatisticsManager statsManager = new StatisticsManager(); statsManager.root(ehcache); this.assocCacheName = ehcache.getName(); ManagementRESTServiceConfiguration mRest = null; if (ehcache != null && ehcache.getCacheManager() != null && ehcache.getCacheManager().getConfiguration() != null) { mRest = ehcache.getCacheManager().getConfiguration().getManagementRESTService(); } this.extended = new ExtendedStatisticsImpl(statsManager, executor, DEFAULT_TIME_TO_DISABLE_MINS, TimeUnit.MINUTES, getProperSampleHistorySize(mRest), getProperSampleIntervalSeconds(mRest), getProperSampleSearchIntervalSeconds(mRest)); this.core = new CoreStatisticsImpl(extended); }
/** * Instantiates a new statistics placeholder. * * @param ehcache the ehcache * @param executor the executor */ public StatisticsGateway(Ehcache ehcache, ScheduledExecutorService executor) { StatisticsManager statsManager = new StatisticsManager(); statsManager.root(ehcache); this.assocCacheName = ehcache.getName(); ManagementRESTServiceConfiguration mRest = null; if (ehcache != null && ehcache.getCacheManager() != null && ehcache.getCacheManager().getConfiguration() != null) { mRest = ehcache.getCacheManager().getConfiguration().getManagementRESTService(); } this.extended = new ExtendedStatisticsImpl(statsManager, executor, DEFAULT_TIME_TO_DISABLE_MINS, TimeUnit.MINUTES, getProperSampleHistorySize(mRest), getProperSampleIntervalSeconds(mRest), getProperSampleSearchIntervalSeconds(mRest)); this.core = new CoreStatisticsImpl(extended); }