All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.ehcache.management.sampled.SampledCache Maven / Gradle / Ivy

Go to download

This is the ehcache core module. Pair it with other modules for added functionality.

There is a newer version: 2.6.11
Show newest version
/**
 *  Copyright 2003-2009 Terracotta, Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package net.sf.ehcache.management.sampled;

import net.sf.ehcache.Ehcache;

/**
 * An implementation of {@link SampledCacheMBean}
 * 
 * 

* * @author Abhishek Sanoujam * @since 1.7 */ public class SampledCache implements SampledCacheMBean { private final Ehcache cache; private final String immutableCacheName; /** * Constructor accepting the backing {@link Ehcache} * * @param cache */ public SampledCache(Ehcache cache) { this.cache = cache; immutableCacheName = cache.getName(); } /** * Method which returns the name of the cache at construction time. * Package protected method. * * @return The name of the cache */ String getImmutableCacheName() { return immutableCacheName; } /** * {@inheritDoc} */ public void flush() { cache.flush(); } /** * {@inheritDoc} */ public String getCacheName() { return cache.getName(); } /** * {@inheritDoc} */ public String getStatus() { return cache.getStatus().toString(); } /** * {@inheritDoc} */ public void removeAll() { cache.removeAll(); } /** * {@inheritDoc} */ public long getAverageGetTimeMostRecentSample() { return cache.getSampledCacheStatistics().getAverageGetTimeMostRecentSample(); } /** * {@inheritDoc} */ public long getCacheElementEvictedMostRecentSample() { return cache.getSampledCacheStatistics().getCacheElementEvictedMostRecentSample(); } /** * {@inheritDoc} */ public long getCacheElementExpiredMostRecentSample() { return cache.getSampledCacheStatistics().getCacheElementExpiredMostRecentSample(); } /** * {@inheritDoc} */ public long getCacheElementPutMostRecentSample() { return cache.getSampledCacheStatistics().getCacheElementPutMostRecentSample(); } /** * {@inheritDoc} */ public long getCacheElementRemovedMostRecentSample() { return cache.getSampledCacheStatistics().getCacheElementRemovedMostRecentSample(); } /** * {@inheritDoc} */ public long getCacheElementUpdatedMostRecentSample() { return cache.getSampledCacheStatistics().getCacheElementUpdatedMostRecentSample(); } /** * {@inheritDoc} */ public long getCacheHitInMemoryMostRecentSample() { return cache.getSampledCacheStatistics().getCacheHitInMemoryMostRecentSample(); } /** * {@inheritDoc} */ public long getCacheHitMostRecentSample() { return cache.getSampledCacheStatistics().getCacheHitMostRecentSample(); } /** * {@inheritDoc} */ public long getCacheHitOnDiskMostRecentSample() { return cache.getSampledCacheStatistics().getCacheHitOnDiskMostRecentSample(); } /** * {@inheritDoc} */ public long getCacheMissExpiredMostRecentSample() { return cache.getSampledCacheStatistics().getCacheMissExpiredMostRecentSample(); } /** * {@inheritDoc} */ public long getCacheMissMostRecentSample() { return cache.getSampledCacheStatistics().getCacheMissMostRecentSample(); } /** * {@inheritDoc} */ public long getCacheMissNotFoundMostRecentSample() { return cache.getSampledCacheStatistics().getCacheMissNotFoundMostRecentSample(); } /** * {@inheritDoc} */ public int getStatisticsAccuracy() { return cache.getSampledCacheStatistics().getStatisticsAccuracy(); } /** * {@inheritDoc} */ public String getStatisticsAccuracyDescription() { return cache.getSampledCacheStatistics().getStatisticsAccuracyDescription(); } /** * {@inheritDoc} */ public void clearStatistics() { cache.clearStatistics(); } /** * {@inheritDoc} */ public boolean isStatisticsEnabled() { return cache.isStatisticsEnabled(); } /** * {@inheritDoc} */ public boolean isSampledStatisticsEnabled() { return cache.getSampledCacheStatistics().isSampledStatisticsEnabled(); } /** * {@inheritDoc} */ public boolean isTerracottaClustered() { return this.cache.getCacheConfiguration().isTerracottaClustered(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#enableStatistics() */ public void enableStatistics() { cache.setStatisticsEnabled(true); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#disableStatistics() */ public void disableStatistics() { cache.setStatisticsEnabled(false); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#enableSampledStatistics() */ public void enableSampledStatistics() { cache.setSampledStatisticsEnabled(true); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#disableSampledStatistics () */ public void disableSampledStatistics() { cache.setSampledStatisticsEnabled(false); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getAverageGetTimeMillis() */ public float getAverageGetTimeMillis() { return cache.getLiveCacheStatistics().getAverageGetTimeMillis(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getCacheHitCount() */ public long getCacheHitCount() { return cache.getLiveCacheStatistics().getCacheHitCount(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getCacheMissCount() */ public long getCacheMissCount() { return cache.getLiveCacheStatistics().getCacheMissCount(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getCacheMissCountExpired() */ public long getCacheMissCountExpired() { return cache.getLiveCacheStatistics().getCacheMissCountExpired(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getConfigDiskExpiryThreadIntervalSeconds() */ public long getConfigDiskExpiryThreadIntervalSeconds() { return cache.getCacheConfiguration().getDiskExpiryThreadIntervalSeconds(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getConfigMaxElementsInMemory() */ public int getConfigMaxElementsInMemory() { return cache.getCacheConfiguration().getMaxElementsInMemory(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getConfigMaxElementsOnDisk() */ public int getConfigMaxElementsOnDisk() { return cache.getCacheConfiguration().getMaxElementsOnDisk(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getConfigMemoryStoreEvictionPolicy() */ public String getConfigMemoryStoreEvictionPolicy() { return cache.getCacheConfiguration().getMemoryStoreEvictionPolicy().toString(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getConfigTimeToIdleSeconds() */ public long getConfigTimeToIdleSeconds() { return cache.getCacheConfiguration().getTimeToIdleSeconds(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getConfigTimeToLiveSeconds() */ public long getConfigTimeToLiveSeconds() { return cache.getCacheConfiguration().getTimeToLiveSeconds(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getEvictedCount() */ public long getEvictedCount() { return cache.getLiveCacheStatistics().getEvictedCount(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getExpiredCount() */ public long getExpiredCount() { return cache.getLiveCacheStatistics().getExpiredCount(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getInMemoryHitCount() */ public long getInMemoryHitCount() { return cache.getLiveCacheStatistics().getInMemoryHitCount(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getInMemorySize() */ public long getInMemorySize() { return cache.getLiveCacheStatistics().getInMemorySize(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getOnDiskHitCount() */ public long getOnDiskHitCount() { return cache.getLiveCacheStatistics().getOnDiskHitCount(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getOnDiskSize() */ public long getOnDiskSize() { return cache.getLiveCacheStatistics().getOnDiskSize(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getPutCount() */ public long getPutCount() { return cache.getLiveCacheStatistics().getPutCount(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getRemovedCount() */ public long getRemovedCount() { return cache.getLiveCacheStatistics().getRemovedCount(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getSize() */ public long getSize() { return cache.getLiveCacheStatistics().getSize(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#getUpdateCount() */ public long getUpdateCount() { return cache.getLiveCacheStatistics().getUpdateCount(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#isConfigDiskPersistent() */ public boolean isConfigDiskPersistent() { return cache.getCacheConfiguration().isDiskPersistent(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#isConfigEternal() */ public boolean isConfigEternal() { return cache.getCacheConfiguration().isEternal(); } /** * {@inheritDoc} * * @see net.sf.ehcache.management.sampled.SampledCacheMBean#isConfigOverflowToDisk() */ public boolean isConfigOverflowToDisk() { return cache.getCacheConfiguration().isOverflowToDisk(); } /** * {@inheritDoc} * * @see net.sf.ehcache.statistics.sampled.SampledCacheStatistics#dispose() */ public void dispose() { // no-op } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy