Example usage for com.google.common.cache CacheStats loadExceptionRate

List of usage examples for com.google.common.cache CacheStats loadExceptionRate

Introduction

In this page you can find the example usage for com.google.common.cache CacheStats loadExceptionRate.

Prototype

public double loadExceptionRate() 

Source Link

Document

Returns the ratio of cache loading attempts which threw exceptions.

Usage

From source file:com.turbospaces.core.CacheStatisticsCounter.java

@Override
public String toString() {
    CacheStats snapshot = super.snapshot();

    return Objects.toStringHelper(this).add("putsCount", putsCount.get()).add("takesCount", takesCount.get())
            .add("exclusiveReadsCount", exclusiveReadsCount.get()).add("hitsCount", snapshot.hitCount())
            .add("missCount", snapshot.missCount()).add("loadSuccessCount", snapshot.loadSuccessCount())
            .add("loadExceptionCount", snapshot.loadExceptionCount())
            .add("loadSuccessRate", snapshot.loadExceptionRate())
            .add("loadExceptionRate", snapshot.loadExceptionRate()).toString();
}

From source file:com.comcast.cdn.traffic_control.traffic_router.core.util.DataExporter.java

private Map<String, Object> createCacheStatsMap(final CacheStats cacheStats) {
    final Map<String, Object> cacheStatsMap = new HashMap<String, Object>();
    cacheStatsMap.put("requestCount", cacheStats.requestCount());
    cacheStatsMap.put("hitCount", cacheStats.hitCount());
    cacheStatsMap.put("missCount", cacheStats.missCount());
    cacheStatsMap.put("hitRate", cacheStats.hitRate());
    cacheStatsMap.put("missRate", cacheStats.missRate());
    cacheStatsMap.put("evictionCount", cacheStats.evictionCount());
    cacheStatsMap.put("loadCount", cacheStats.loadCount());
    cacheStatsMap.put("loadSuccessCount", cacheStats.loadSuccessCount());
    cacheStatsMap.put("loadExceptionCount", cacheStats.loadExceptionCount());
    cacheStatsMap.put("loadExceptionRate", cacheStats.loadExceptionRate());
    cacheStatsMap.put("totalLoadTime", cacheStats.totalLoadTime());
    cacheStatsMap.put("averageLoadPenalty", cacheStats.averageLoadPenalty());
    return cacheStatsMap;
}

From source file:org.springframework.integration.jdbc.StoredProcExecutor.java

/**
 * Allows for the retrieval of metrics ({@link CacheStats}}) for the
 * {@link StoredProcExecutor#jdbcCallOperationsCache}.
 *
 * Provides the properties of {@link CacheStats} as a {@link Map}. This allows
 * for exposing the those properties easily via JMX.
 *
 * @return Map containing metrics of the JdbcCallOperationsCache
 *
 * @see StoredProcExecutor#getJdbcCallOperationsCacheStatistics()
 *///  w  ww .  j a va  2  s . com
@ManagedMetric
public Map<String, Object> getJdbcCallOperationsCacheStatisticsAsMap() {
    final CacheStats cacheStats = this.getJdbcCallOperationsCacheStatistics();
    final Map<String, Object> cacheStatistics = new HashMap<String, Object>(11);
    cacheStatistics.put("averageLoadPenalty", cacheStats.averageLoadPenalty());
    cacheStatistics.put("evictionCount", cacheStats.evictionCount());
    cacheStatistics.put("hitCount", cacheStats.hitCount());
    cacheStatistics.put("hitRate", cacheStats.hitRate());
    cacheStatistics.put("loadCount", cacheStats.loadCount());
    cacheStatistics.put("loadExceptionCount", cacheStats.loadExceptionCount());
    cacheStatistics.put("loadExceptionRate", cacheStats.loadExceptionRate());
    cacheStatistics.put("loadSuccessCount", cacheStats.loadSuccessCount());
    cacheStatistics.put("missCount", cacheStats.missCount());
    cacheStatistics.put("missRate", cacheStats.missRate());
    cacheStatistics.put("totalLoadTime", cacheStats.totalLoadTime());
    return Collections.unmodifiableMap(cacheStatistics);
}

From source file:com.adobe.acs.commons.util.impl.AbstractGuavaCacheMBean.java

@Override
@SuppressWarnings("squid:S1192")
public final TabularData getCacheStats() throws OpenDataException {
    // Exposing all google guava stats.
    final CompositeType cacheEntryType = new CompositeType(JMX_PN_CACHESTATS, JMX_PN_CACHESTATS,
            new String[] { JMX_PN_STAT, JMX_PN_VALUE }, new String[] { JMX_PN_STAT, JMX_PN_VALUE },
            new OpenType[] { SimpleType.STRING, SimpleType.STRING });

    final TabularDataSupport tabularData = new TabularDataSupport(new TabularType(JMX_PN_CACHESTATS,
            JMX_PN_CACHESTATS, cacheEntryType, new String[] { JMX_PN_STAT }));

    CacheStats cacheStats = getCache().stats();

    final Map<String, Object> row = new HashMap<String, Object>();

    row.put(JMX_PN_STAT, "Request Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.requestCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Hit Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.hitCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Hit Rate");
    row.put(JMX_PN_VALUE, String.format("%.0f%%", cacheStats.hitRate() * 100));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Miss Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.missCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Miss Rate");
    row.put(JMX_PN_VALUE, String.format("%.0f%%", cacheStats.missRate() * 100));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Eviction Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.evictionCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Load Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.loadCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Load Exception Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.loadExceptionCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Load Exception Rate");
    row.put(JMX_PN_VALUE, String.format("%.0f%%", cacheStats.loadExceptionRate() * 100));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Load Success Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.loadSuccessCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Average Load Penalty");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.averageLoadPenalty()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Total Load Time");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.totalLoadTime()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    return tabularData;
}