/** * Find processed statistic. * * @param cache the cache * @return the set */ public static Set<ExtendedStatistics.Statistic<Number>> findProcessedStatistic(Ehcache cache) { return cache.getStatistics().getExtended().passthru("processed", Collections.singletonMap("refreshahead", null).keySet()); }
/** * {@inheritDoc} */ @Override public int getCacheHitRatio() { return (int) (cache.getStatistics().getExtended().cacheHitRatio().value().doubleValue() * ONE_HUNDRED); }
/** * Instantiates a new core statistics impl. * * @param extended the extended */ public CoreStatisticsImpl(ExtendedStatistics extended) { this.extended = extended; this.cacheGet = asCountOperation(extended.get()); this.cachePut = asCountOperation(extended.put()); this.cacheRemove = asCountOperation(extended.remove()); this.cacheReplace1 = asCountOperation(extended.replaceOneArg()); this.cacheReplace2 = asCountOperation(extended.replaceOneArg()); this.cachePutIfAbsent = asCountOperation(extended.putIfAbsent()); this.cacheRemoveElement = asCountOperation(extended.removeElement()); this.localHeapGet = asCountOperation(extended.heapGet()); this.localHeapPut = asCountOperation(extended.heapPut()); this.localHeapRemove = asCountOperation(extended.heapRemove()); this.localOffHeapGet = asCountOperation(extended.offheapGet()); this.localOffHeapPut = asCountOperation(extended.offheapPut()); this.localOffHeapRemove = asCountOperation(extended.offheapRemove()); this.localDiskGet = asCountOperation(extended.diskGet()); this.localDiskPut = asCountOperation(extended.diskPut()); this.localDiskRemove = asCountOperation(extended.diskRemove()); this.xaCommit = asCountOperation(extended.xaCommit()); this.xaRecovery = asCountOperation(extended.xaRecovery()); this.xaRollback = asCountOperation(extended.xaRollback()); this.evicted = asCountOperation(extended.eviction()); this.expired = asCountOperation(extended.expiry()); this.cacheClusterEvent = asCountOperation(extended.clusterEvent()); }
@Override public long getCacheClusterOfflineMostRecentSample() { return cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.OFFLINE).rate().value().longValue(); }
@Override public long getCacheClusterOnlineMostRecentSample() { return cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.ONLINE).rate().value().longValue(); }
/** * Instantiates a new core statistics impl. * * @param extended the extended */ public CoreStatisticsImpl(ExtendedStatistics extended) { this.extended = extended; this.cacheGet = asCountOperation(extended.get()); this.cachePut = asCountOperation(extended.put()); this.cacheRemove = asCountOperation(extended.remove()); this.cacheReplace1 = asCountOperation(extended.replaceOneArg()); this.cacheReplace2 = asCountOperation(extended.replaceOneArg()); this.cachePutIfAbsent = asCountOperation(extended.putIfAbsent()); this.cacheRemoveElement = asCountOperation(extended.removeElement()); this.localHeapGet = asCountOperation(extended.heapGet()); this.localHeapPut = asCountOperation(extended.heapPut()); this.localHeapRemove = asCountOperation(extended.heapRemove()); this.localOffHeapGet = asCountOperation(extended.offheapGet()); this.localOffHeapPut = asCountOperation(extended.offheapPut()); this.localOffHeapRemove = asCountOperation(extended.offheapRemove()); this.localDiskGet = asCountOperation(extended.diskGet()); this.localDiskPut = asCountOperation(extended.diskPut()); this.localDiskRemove = asCountOperation(extended.diskRemove()); this.xaCommit = asCountOperation(extended.xaCommit()); this.xaRecovery = asCountOperation(extended.xaRecovery()); this.xaRollback = asCountOperation(extended.xaRollback()); this.evicted = asCountOperation(extended.eviction()); this.expired = asCountOperation(extended.expiry()); this.cacheClusterEvent = asCountOperation(extended.clusterEvent()); }
/** * Find job counter statistic. Number of batch jobs executed on this node. * * @param cache the cache this statistic is attached to. * @return the set */ public static Set<ExtendedStatistics.Statistic<Number>> findJobStatistics(Ehcache cache) { return cache.getStatistics().getExtended().passthru("job", Collections.singletonMap("scheduledrefresh", null).keySet()); }
@Override public long getCacheClusterRejoinMostRecentSample() { return cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.REJOINED).rate().value().longValue(); }
/** * {@inheritDoc} */ @Override public SampledCounter getCacheHitRatioSample() { return new SampledCounterProxy<Double>(cache.getStatistics().getExtended().cacheHitRatio()) { @Override public TimeStampedCounterValue getMostRecentSample() { return new TimeStampedCounterValue(System.currentTimeMillis(), getValue()); } @Override public TimeStampedCounterValue[] getAllSampleValues() { ArrayList<TimeStampedCounterValue> arr = new ArrayList<TimeStampedCounterValue>(); for (Timestamped<Double> ts : rate.history()) { arr.add(new TimeStampedCounterValue(ts.getTimestamp(), (int) (ts.getSample().doubleValue() * ONE_HUNDRED))); } return sortAndPresent(arr); } @Override public long getValue() { return (long) (rate.value().doubleValue() * ONE_HUNDRED); } }; }
/** * Instantiates a new core statistics impl. * * @param extended the extended */ public CoreStatisticsImpl(ExtendedStatistics extended) { this.extended = extended; this.cacheGet = asCountOperation(extended.get()); this.cachePut = asCountOperation(extended.put()); this.cacheRemove = asCountOperation(extended.remove()); this.cacheReplace1 = asCountOperation(extended.replaceOneArg()); this.cacheReplace2 = asCountOperation(extended.replaceOneArg()); this.cachePutIfAbsent = asCountOperation(extended.putIfAbsent()); this.cacheRemoveElement = asCountOperation(extended.removeElement()); this.localHeapGet = asCountOperation(extended.heapGet()); this.localHeapPut = asCountOperation(extended.heapPut()); this.localHeapRemove = asCountOperation(extended.heapRemove()); this.localOffHeapGet = asCountOperation(extended.offheapGet()); this.localOffHeapPut = asCountOperation(extended.offheapPut()); this.localOffHeapRemove = asCountOperation(extended.offheapRemove()); this.localDiskGet = asCountOperation(extended.diskGet()); this.localDiskPut = asCountOperation(extended.diskPut()); this.localDiskRemove = asCountOperation(extended.diskRemove()); this.xaCommit = asCountOperation(extended.xaCommit()); this.xaRecovery = asCountOperation(extended.xaRecovery()); this.xaRollback = asCountOperation(extended.xaRollback()); this.evicted = asCountOperation(extended.eviction()); this.expired = asCountOperation(extended.expiry()); this.cacheClusterEvent = asCountOperation(extended.clusterEvent()); }
/** * Find offer statistic. * * @param cache the cache this statistic is attached to. * @return the set */ public static Set<ExtendedStatistics.Statistic<Number>> findOfferStatistic(Ehcache cache) { return cache.getStatistics().getExtended().passthru("offered", Collections.singletonMap("refreshahead", null).keySet()); }
@Override public SampledCounter getCacheClusterRejoinSample() { return new SampledRateCounterProxy(cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.REJOINED).rate()); }
/** * {@inheritDoc} */ @Override public int getCacheHitRatio() { return (int) (cache.getStatistics().getExtended().cacheHitRatio().value().doubleValue() * ONE_HUNDRED); }
/** * Find dropped statistic. * * @param cache the cache * @return the set */ public static Set<ExtendedStatistics.Statistic<Number>> findDroppedStatistic(Ehcache cache) { return cache.getStatistics().getExtended().passthru("dropped", Collections.singletonMap("refreshahead", null).keySet()); }
@Override public SampledCounter getCacheClusterOfflineSample() { return new SampledRateCounterProxy(cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.OFFLINE).rate()); }
/** * {@inheritDoc} */ @Override public int getCacheHitRatio() { return (int) (cache.getStatistics().getExtended().cacheHitRatio().value().doubleValue() * ONE_HUNDRED); }
/** * Find refreshed counter statistic. * * @param cache the cache this statistic is attached to. * @return the set */ public static Set<ExtendedStatistics.Statistic<Number>> findRefreshedStatistic(Ehcache cache) { return cache.getStatistics().getExtended().passthru("refreshed", Collections.singletonMap("refreshahead", null).keySet()); }
@Override public SampledCounter getCacheClusterOnlineSample() { return new SampledRateCounterProxy(cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.ONLINE).rate()); }
/** * {@inheritDoc} */ @Override public SampledCounter getCacheHitRatioSample() { return new SampledCounterProxy<Double>(cache.getStatistics().getExtended().cacheHitRatio()) { @Override public TimeStampedCounterValue getMostRecentSample() { return new TimeStampedCounterValue(System.currentTimeMillis(), getValue()); } @Override public TimeStampedCounterValue[] getAllSampleValues() { ArrayList<TimeStampedCounterValue> arr = new ArrayList<TimeStampedCounterValue>(); for (Timestamped<Double> ts : rate.history()) { arr.add(new TimeStampedCounterValue(ts.getTimestamp(), (int) (ts.getSample().doubleValue() * ONE_HUNDRED))); } return sortAndPresent(arr); } @Override public long getValue() { return (long) (rate.value().doubleValue() * ONE_HUNDRED); } }; }
/** * Find backlog statistic. * * @param cache the cache * @return the set */ public static Set<ExtendedStatistics.Statistic<Number>> findBacklogStatistic(Ehcache cache) { return cache.getStatistics().getExtended().passthru("backlog", Collections.singletonMap("refreshahead", null).keySet()); }