@Test public void given_clustered_cache__cacheSampler_getSize_returns_quick_size() throws Exception { cacheConfiguration.terracotta(new TerracottaConfiguration().clustered(true)); CacheSamplerImpl cacheSampler = new CacheSamplerImpl(cache); assertThat(cacheSampler.getSize(), equalTo(QUICK_SIZE)); }
@Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } CacheSamplerImpl(Ehcache cache); }
CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } CacheSamplerImpl(Ehcache cache); @Override boolean isEnabled(); @Override void setEnabled(boolean enabled); @Override boolean isClusterBulkLoadEnabled(); @Override boolean isNodeBulkLoadEnabled(); @Override void setNodeBulkLoadEnabled(boolean bulkLoadEnabled); @Override void flush(); @Override String getCacheName(); @Override String getStatus(); @Override void removeAll(); @Override long getAverageGetTimeNanosMostRecentSample(); @Override long getCacheEvictionRate(); @Override long getCacheElementEvictedMostRecentSample(); @Override long getCacheExpirationRate(); @Override long getCacheElementExpiredMostRecentSample(); @Override long getCachePutRate(); @Override long getCacheElementPutMostRecentSample(); @Override long getCacheRemoveRate(); @Override long getCacheElementRemovedMostRecentSample(); @Override long getCacheUpdateRate(); @Override long getCacheElementUpdatedMostRecentSample(); @Override long getCacheInMemoryHitRate(); @Override long getCacheHitInMemoryMostRecentSample(); @Override long getCacheOffHeapHitRate(); @Override long getCacheHitOffHeapMostRecentSample(); @Override long getCacheHitRate(); @Override long getCacheHitMostRecentSample(); @Override long getCacheOnDiskHitRate(); @Override long getCacheHitOnDiskMostRecentSample(); @Override long getCacheMissExpiredMostRecentSample(); @Override long getCacheMissRate(); @Override long getCacheMissMostRecentSample(); @Override long getCacheInMemoryMissRate(); @Override long getCacheMissInMemoryMostRecentSample(); @Override long getCacheOffHeapMissRate(); @Override long getCacheMissOffHeapMostRecentSample(); @Override long getCacheOnDiskMissRate(); @Override long getCacheMissOnDiskMostRecentSample(); @Override long getCacheMissNotFoundMostRecentSample(); @Override void dispose(); @Override boolean isTerracottaClustered(); @Override String getTerracottaConsistency(); @Override long getAverageGetTime(); @Override Long getMaxGetTimeNanos(); @Override Long getMinGetTimeNanos(); @Override long getXaCommitCount(); @Override long getXaRollbackCount(); @Override long getXaRecoveredCount(); @Override boolean getHasWriteBehindWriter(); @Override long getWriterQueueLength(); @Override int getWriterMaxQueueSize(); @Override int getWriterConcurrency(); @Override long getCacheHitCount(); @Override long getCacheMissCount(); @Override long getInMemoryMissCount(); @Override long getOffHeapMissCount(); @Override long getOnDiskMissCount(); @Override long getCacheMissCountExpired(); @Override long getDiskExpiryThreadIntervalSeconds(); @Override void setDiskExpiryThreadIntervalSeconds(long seconds); @Override long getMaxEntriesLocalHeap(); @Override void setMaxEntriesLocalHeap(long maxEntries); @Override long getMaxBytesLocalHeap(); @Override void setMaxBytesLocalHeap(long maxBytes); @Override void setMaxBytesLocalHeapAsString(String maxBytes); @Override String getMaxBytesLocalHeapAsString(); @Override long getMaxEntriesLocalDisk(); @Override void setMaxEntriesLocalDisk(long maxEntries); @Override void setMaxBytesLocalDisk(long maxBytes); @Override void setMaxBytesLocalDiskAsString(String maxBytes); @Override String getMaxBytesLocalDiskAsString(); @Override int getMaxElementsOnDisk(); @Override long getMaxEntriesInCache(); @Override void setMaxElementsOnDisk(int maxElements); @Override void setMaxEntriesInCache(long maxEntries); @Override long getMaxBytesLocalDisk(); @Override long getMaxBytesLocalOffHeap(); @Override String getMaxBytesLocalOffHeapAsString(); @Override String getMemoryStoreEvictionPolicy(); @Override void setMemoryStoreEvictionPolicy(String evictionPolicy); @Override long getTimeToIdleSeconds(); @Override void setTimeToIdleSeconds(long tti); @Override long getTimeToLiveSeconds(); @Override void setTimeToLiveSeconds(long ttl); @Override boolean isDiskPersistent(); @Override String getPersistenceStrategy(); @Override void setDiskPersistent(boolean diskPersistent); @Override boolean isOverflowToOffHeap(); @Override boolean isEternal(); @Override void setEternal(boolean eternal); @Override boolean isOverflowToDisk(); @Override void setOverflowToDisk(boolean overflowToDisk); @Override boolean isLoggingEnabled(); @Override void setLoggingEnabled(boolean enabled); @Override boolean isPinned(); @Override String getPinnedToStore(); @Override long getEvictedCount(); @Override long getExpiredCount(); @Override long getInMemoryHitCount(); @Override long getOffHeapHitCount(); @Deprecated @Override long getOffHeapSize(); @Override long getOnDiskHitCount(); @Deprecated @Override long getOnDiskSize(); @Override long getLocalDiskSize(); @Override long getLocalHeapSize(); @Override long getLocalOffHeapSize(); @Override long getLocalDiskSizeInBytes(); @Override long getLocalHeapSizeInBytes(); @Override long getLocalOffHeapSizeInBytes(); @Override long getPutCount(); @Override long getRemovedCount(); @Override long getSize(); @Override long getInMemorySize(); @Override long getUpdateCount(); @Override void deregistered(CacheConfiguration config); @Override void maxBytesLocalHeapChanged(final long oldValue, final long newValue); @Override void maxBytesLocalDiskChanged(final long oldValue, final long newValue); @Override void diskCapacityChanged(int oldCapacity, int newCapacity); @Override void maxEntriesInCacheChanged(long oldCapacity, long newCapacity); @Override void loggingChanged(boolean oldValue, boolean newValue); @Override void memoryCapacityChanged(int oldCapacity, int newCapacity); @Override void registered(CacheConfiguration config); @Override void timeToIdleChanged(long oldTimeToIdle, long newTimeToIdle); @Override void timeToLiveChanged(long oldTimeToLive, long newTimeToLive); @Override long getAverageSearchTime(); @Override long getSearchesPerSecond(); @Override boolean getTransactional(); @Override boolean getSearchable(); @Override Map<String, String> getSearchAttributes(); @Override long getCacheSearchRate(); @Override long getTransactionCommitRate(); @Override long getCacheXaCommitsMostRecentSample(); @Override long getTransactionRollbackRate(); @Override long getCacheXaRollbacksMostRecentSample(); @Override boolean isLocalHeapCountBased(); @Override int getCacheHitRatio(); @Override int getCacheHitRatioMostRecentSample(); @Override SampledCounter getCacheHitRatioSample(); @Override long getAverageGetTimeNanos(); @Override SampledCounter getCacheHitSample(); @Override SampledCounter getCacheHitInMemorySample(); @Override SampledCounter getCacheHitOffHeapSample(); @Override SampledCounter getCacheHitOnDiskSample(); @Override SampledCounter getCacheMissSample(); @Override SampledCounter getCacheMissInMemorySample(); @Override SampledCounter getCacheMissOffHeapSample(); @Override SampledCounter getCacheMissOnDiskSample(); @Override SampledCounter getCacheMissExpiredSample(); @Override SampledCounter getCacheMissNotFoundSample(); @Override SampledCounter getCacheElementEvictedSample(); @Override SampledCounter getCacheElementRemovedSample(); @Override SampledCounter getCacheElementExpiredSample(); @Override SampledCounter getCacheElementPutSample(); @Override SampledCounter getCacheElementUpdatedSample(); @Override SampledRateCounter getAverageGetTimeSample(); @Override SampledRateCounter getAverageSearchTimeSample(); @Override SampledCounter getSearchesPerSecondSample(); @Override SampledCounter getCacheXaCommitsSample(); @Override SampledCounter getCacheXaRollbacksSample(); @Override SampledCounter getSizeSample(); @Override SampledCounter getLocalHeapSizeSample(); @Override SampledCounter getLocalHeapSizeInBytesSample(); @Override SampledCounter getLocalOffHeapSizeSample(); @Override SampledCounter getLocalOffHeapSizeInBytesSample(); @Override SampledCounter getLocalDiskSizeSample(); @Override SampledCounter getLocalDiskSizeInBytesSample(); @Override SampledCounter getRemoteSizeSample(); @Override SampledCounter getWriterQueueLengthSample(); @Override long getAverageSearchTimeNanos(); @Override long getCacheClusterOfflineCount(); @Override long getCacheClusterRejoinCount(); @Override long getCacheClusterOnlineCount(); @Override long getCacheClusterOfflineMostRecentSample(); @Override long getCacheClusterRejoinMostRecentSample(); @Override long getCacheClusterOnlineMostRecentSample(); @Override SampledCounter getCacheClusterOfflineSample(); @Override SampledCounter getCacheClusterOnlineSample(); @Override SampledCounter getCacheClusterRejoinSample(); @Override long getMostRecentRejoinTimeStampMillis(); @Override SampledCounter getMostRecentRejoinTimestampMillisSample(); @Override long getNonStopSuccessCount(); @Override long getNonStopFailureCount(); @Override long getNonStopRejoinTimeoutCount(); @Override long getNonStopTimeoutCount(); @Override long getNonStopSuccessMostRecentSample(); @Override long getNonStopFailureMostRecentSample(); @Override long getNonStopRejoinTimeoutMostRecentSample(); @Override long getNonStopTimeoutMostRecentSample(); @Override SampledCounter getNonStopSuccessSample(); @Override SampledCounter getNonStopFailureSample(); @Override SampledCounter getNonStopRejoinTimeoutSample(); @Override SampledCounter getNonStopTimeoutSample(); @Override long getNonStopSuccessRate(); @Override long getNonStopFailureRate(); @Override long getNonStopRejoinTimeoutRate(); @Override long getNonStopTimeoutRate(); @Override int getNonstopTimeoutRatio(); }
CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { @Override public long getSize() { if (cache.getCacheConfiguration().isTerracottaClustered()) { return getRemoteSizeSample().getMostRecentSample().getCounterValue(); } try { return cache.getStatistics().getSize(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } CacheSamplerImpl(Ehcache cache); @Override boolean isEnabled(); @Override void setEnabled(boolean enabled); @Override boolean isClusterBulkLoadEnabled(); @Override boolean isNodeBulkLoadEnabled(); @Override void setNodeBulkLoadEnabled(boolean bulkLoadEnabled); @Override void flush(); @Override String getCacheName(); @Override String getStatus(); @Override void removeAll(); @Override long getAverageGetTimeNanosMostRecentSample(); @Override long getCacheEvictionRate(); @Override long getCacheElementEvictedMostRecentSample(); @Override long getCacheExpirationRate(); @Override long getCacheElementExpiredMostRecentSample(); @Override long getCachePutRate(); @Override long getCacheElementPutMostRecentSample(); @Override long getCacheRemoveRate(); @Override long getCacheElementRemovedMostRecentSample(); @Override long getCacheUpdateRate(); @Override long getCacheElementUpdatedMostRecentSample(); @Override long getCacheInMemoryHitRate(); @Override long getCacheHitInMemoryMostRecentSample(); @Override long getCacheOffHeapHitRate(); @Override long getCacheHitOffHeapMostRecentSample(); @Override long getCacheHitRate(); @Override long getCacheHitMostRecentSample(); @Override long getCacheOnDiskHitRate(); @Override long getCacheHitOnDiskMostRecentSample(); @Override long getCacheMissExpiredMostRecentSample(); @Override long getCacheMissRate(); @Override long getCacheMissMostRecentSample(); @Override long getCacheInMemoryMissRate(); @Override long getCacheMissInMemoryMostRecentSample(); @Override long getCacheOffHeapMissRate(); @Override long getCacheMissOffHeapMostRecentSample(); @Override long getCacheOnDiskMissRate(); @Override long getCacheMissOnDiskMostRecentSample(); @Override long getCacheMissNotFoundMostRecentSample(); @Override void dispose(); @Override boolean isTerracottaClustered(); @Override String getTerracottaConsistency(); @Override long getAverageGetTime(); @Override Long getMaxGetTimeNanos(); @Override Long getMinGetTimeNanos(); @Override long getXaCommitCount(); @Override long getXaRollbackCount(); @Override long getXaRecoveredCount(); @Override boolean getHasWriteBehindWriter(); @Override long getWriterQueueLength(); @Override int getWriterMaxQueueSize(); @Override int getWriterConcurrency(); @Override long getCacheHitCount(); @Override long getCacheMissCount(); @Override long getInMemoryMissCount(); @Override long getOffHeapMissCount(); @Override long getOnDiskMissCount(); @Override long getCacheMissCountExpired(); @Override long getDiskExpiryThreadIntervalSeconds(); @Override void setDiskExpiryThreadIntervalSeconds(long seconds); @Override long getMaxEntriesLocalHeap(); @Override void setMaxEntriesLocalHeap(long maxEntries); @Override long getMaxBytesLocalHeap(); @Override void setMaxBytesLocalHeap(long maxBytes); @Override void setMaxBytesLocalHeapAsString(String maxBytes); @Override String getMaxBytesLocalHeapAsString(); @Override long getMaxEntriesLocalDisk(); @Override void setMaxEntriesLocalDisk(long maxEntries); @Override void setMaxBytesLocalDisk(long maxBytes); @Override void setMaxBytesLocalDiskAsString(String maxBytes); @Override String getMaxBytesLocalDiskAsString(); @Override int getMaxElementsOnDisk(); @Override long getMaxEntriesInCache(); @Override void setMaxElementsOnDisk(int maxElements); @Override void setMaxEntriesInCache(long maxEntries); @Override long getMaxBytesLocalDisk(); @Override long getMaxBytesLocalOffHeap(); @Override String getMaxBytesLocalOffHeapAsString(); @Override String getMemoryStoreEvictionPolicy(); @Override void setMemoryStoreEvictionPolicy(String evictionPolicy); @Override long getTimeToIdleSeconds(); @Override void setTimeToIdleSeconds(long tti); @Override long getTimeToLiveSeconds(); @Override void setTimeToLiveSeconds(long ttl); @Override boolean isDiskPersistent(); @Override String getPersistenceStrategy(); @Override void setDiskPersistent(boolean diskPersistent); @Override boolean isOverflowToOffHeap(); @Override boolean isEternal(); @Override void setEternal(boolean eternal); @Override boolean isOverflowToDisk(); @Override void setOverflowToDisk(boolean overflowToDisk); @Override boolean isLoggingEnabled(); @Override void setLoggingEnabled(boolean enabled); @Override boolean isPinned(); @Override String getPinnedToStore(); @Override long getEvictedCount(); @Override long getExpiredCount(); @Override long getInMemoryHitCount(); @Override long getOffHeapHitCount(); @Deprecated @Override long getOffHeapSize(); @Override long getOnDiskHitCount(); @Deprecated @Override long getOnDiskSize(); @Override long getLocalDiskSize(); @Override long getLocalHeapSize(); @Override long getLocalOffHeapSize(); @Override long getLocalDiskSizeInBytes(); @Override long getLocalHeapSizeInBytes(); @Override long getLocalOffHeapSizeInBytes(); @Override long getPutCount(); @Override long getRemovedCount(); @Override long getSize(); @Override long getInMemorySize(); @Override long getUpdateCount(); @Override void deregistered(CacheConfiguration config); @Override void maxBytesLocalHeapChanged(final long oldValue, final long newValue); @Override void maxBytesLocalDiskChanged(final long oldValue, final long newValue); @Override void diskCapacityChanged(int oldCapacity, int newCapacity); @Override void maxEntriesInCacheChanged(long oldCapacity, long newCapacity); @Override void loggingChanged(boolean oldValue, boolean newValue); @Override void memoryCapacityChanged(int oldCapacity, int newCapacity); @Override void registered(CacheConfiguration config); @Override void timeToIdleChanged(long oldTimeToIdle, long newTimeToIdle); @Override void timeToLiveChanged(long oldTimeToLive, long newTimeToLive); @Override long getAverageSearchTime(); @Override long getSearchesPerSecond(); @Override boolean getTransactional(); @Override boolean getSearchable(); @Override Map<String, String> getSearchAttributes(); @Override long getCacheSearchRate(); @Override long getTransactionCommitRate(); @Override long getCacheXaCommitsMostRecentSample(); @Override long getTransactionRollbackRate(); @Override long getCacheXaRollbacksMostRecentSample(); @Override boolean isLocalHeapCountBased(); @Override int getCacheHitRatio(); @Override int getCacheHitRatioMostRecentSample(); @Override SampledCounter getCacheHitRatioSample(); @Override long getAverageGetTimeNanos(); @Override SampledCounter getCacheHitSample(); @Override SampledCounter getCacheHitInMemorySample(); @Override SampledCounter getCacheHitOffHeapSample(); @Override SampledCounter getCacheHitOnDiskSample(); @Override SampledCounter getCacheMissSample(); @Override SampledCounter getCacheMissInMemorySample(); @Override SampledCounter getCacheMissOffHeapSample(); @Override SampledCounter getCacheMissOnDiskSample(); @Override SampledCounter getCacheMissExpiredSample(); @Override SampledCounter getCacheMissNotFoundSample(); @Override SampledCounter getCacheElementEvictedSample(); @Override SampledCounter getCacheElementRemovedSample(); @Override SampledCounter getCacheElementExpiredSample(); @Override SampledCounter getCacheElementPutSample(); @Override SampledCounter getCacheElementUpdatedSample(); @Override SampledRateCounter getAverageGetTimeSample(); @Override SampledRateCounter getAverageSearchTimeSample(); @Override SampledCounter getSearchesPerSecondSample(); @Override SampledCounter getCacheXaCommitsSample(); @Override SampledCounter getCacheXaRollbacksSample(); @Override SampledCounter getSizeSample(); @Override SampledCounter getLocalHeapSizeSample(); @Override SampledCounter getLocalHeapSizeInBytesSample(); @Override SampledCounter getLocalOffHeapSizeSample(); @Override SampledCounter getLocalOffHeapSizeInBytesSample(); @Override SampledCounter getLocalDiskSizeSample(); @Override SampledCounter getLocalDiskSizeInBytesSample(); @Override SampledCounter getRemoteSizeSample(); @Override SampledCounter getWriterQueueLengthSample(); @Override long getAverageSearchTimeNanos(); @Override long getCacheClusterOfflineCount(); @Override long getCacheClusterRejoinCount(); @Override long getCacheClusterOnlineCount(); @Override long getCacheClusterOfflineMostRecentSample(); @Override long getCacheClusterRejoinMostRecentSample(); @Override long getCacheClusterOnlineMostRecentSample(); @Override SampledCounter getCacheClusterOfflineSample(); @Override SampledCounter getCacheClusterOnlineSample(); @Override SampledCounter getCacheClusterRejoinSample(); @Override long getMostRecentRejoinTimeStampMillis(); @Override SampledCounter getMostRecentRejoinTimestampMillisSample(); @Override long getNonStopSuccessCount(); @Override long getNonStopFailureCount(); @Override long getNonStopRejoinTimeoutCount(); @Override long getNonStopTimeoutCount(); @Override long getNonStopSuccessMostRecentSample(); @Override long getNonStopFailureMostRecentSample(); @Override long getNonStopRejoinTimeoutMostRecentSample(); @Override long getNonStopTimeoutMostRecentSample(); @Override SampledCounter getNonStopSuccessSample(); @Override SampledCounter getNonStopFailureSample(); @Override SampledCounter getNonStopRejoinTimeoutSample(); @Override SampledCounter getNonStopTimeoutSample(); @Override long getNonStopSuccessRate(); @Override long getNonStopFailureRate(); @Override long getNonStopRejoinTimeoutRate(); @Override long getNonStopTimeoutRate(); @Override int getNonstopTimeoutRatio();  }