2
* Copyright 2003-2010 Terracotta, Inc.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
package net.sf.ehcache.management.sampled;
19
import net.sf.ehcache.statistics.LiveCacheStatistics;
20
import net.sf.ehcache.statistics.sampled.SampledCacheStatistics;
23
* An MBean for Cache exposing cache statistics.
24
* Extends from both {@link LiveCacheStatistics} and {@link SampledCacheStatistics}
28
* @author <a href="mailto:asanoujam@terracottatech.com">Abhishek Sanoujam</a>
31
public interface SampledCacheMBean extends LiveCacheStatistics, SampledCacheStatistics {
35
public static final String CACHE_ENABLED = "CacheEnabled";
40
public static final String CACHE_CHANGED = "CacheChanged";
45
public static final String CACHE_FLUSHED = "CacheFlushed";
50
public static final String CACHE_CLEARED = "CacheCleared";
53
* CACHE_STATISTICS_ENABLED
55
public static final String CACHE_STATISTICS_ENABLED = "CacheStatisticsEnabled";
58
* CACHE_STATISTICS_RESET
60
public static final String CACHE_STATISTICS_RESET = "CacheStatisticsReset";
63
* Is the cache enabled?
68
* Enabled/disable cache coherence mode for this node.
70
void setNodeCoherent(boolean coherent);
73
* Is the cache coherent cluster-wide?
75
boolean isClusterCoherent();
78
* Is the cache coherent locally?
80
boolean isNodeCoherent();
83
* Enabled/disable the cache.
85
void setEnabled(boolean enabled);
88
* Removes all cached items.
93
* Flushes all cache items from memory to the disk store, and from the
99
* Gets the status attribute of the Cache.
101
* @return The status value from the Status enum class
106
* Is the cache configured with Terracotta clustering?
108
* @return true if clustered with terracotta
110
public boolean isTerracottaClustered();
113
* Clear both sampled and cumulative statistics
115
public void clearStatistics();
118
* Enables statistics collection
120
public void enableStatistics();
123
* Disables statistics collection. Also disables sampled statistics if it is
126
public void disableStatistics();
129
* Controls the statistics. Also controls sampled statistics if it is
132
public void setStatisticsEnabled(boolean statsEnabled);
135
* Enables statistics collection. As it requires that normal statistics
136
* collection to be enabled, it enables it if its not already
138
public void enableSampledStatistics();
141
* Disables statistics collection
143
public void disableSampledStatistics();
146
* Configuration property accessor
148
* @return Max elements in memory config setting value
150
public int getConfigMaxElementsInMemory();
153
* setConfigMaxElementsInMemory
156
public void setConfigMaxElementsInMemory(int maxElements);
159
* Configuration property accessor
161
* @return Max elements on disk config setting value
163
public int getConfigMaxElementsOnDisk();
166
* setConfigMaxElementsOnDisk
169
public void setConfigMaxElementsOnDisk(int maxElements);
172
* Configuration property accessor
174
* @return a String representation of the policy
176
public String getConfigMemoryStoreEvictionPolicy();
179
* setConfigMemoryStoreEvictionPolicy
180
* @param evictionPolicy
182
public void setConfigMemoryStoreEvictionPolicy(String evictionPolicy);
185
* Configuration property accessor
187
* @return true if set to eternal in config
189
public boolean isConfigEternal();
195
public void setConfigEternal(boolean eternal);
198
* Configuration property accessor
200
* @return TTI in config
202
public long getConfigTimeToIdleSeconds();
205
* setConfigTimeToIdleSeconds
208
public void setConfigTimeToIdleSeconds(long tti);
211
* Configuration property accessor
213
* @return TTL in config
215
public long getConfigTimeToLiveSeconds();
218
* setConfigTimeToLiveSeconds
221
public void setConfigTimeToLiveSeconds(long ttl);
224
* Configuration property accessor
226
* @return true if overflow to disk specified in config
228
public boolean isConfigOverflowToDisk();
231
* setConfigOverflowToDisk
232
* @param overflowToDisk
234
public void setConfigOverflowToDisk(boolean overflowToDisk);
237
* Configuration property accessor
239
* @return true if configured with disk persistence
241
public boolean isConfigDiskPersistent();
244
* setConfigDiskPersistent
245
* @param diskPersistent
247
public void setConfigDiskPersistent(boolean diskPersistent);
250
* Configuration property accessor
252
* @return Value for disk expiry thread interval in seconds specified in config
254
public long getConfigDiskExpiryThreadIntervalSeconds();
257
* setConfigDiskExpiryThreadIntervalSeconds
260
public void setConfigDiskExpiryThreadIntervalSeconds(long seconds);
263
* Configuration property accessor
265
* @return true if logging is enabled on the cache
267
public boolean isConfigLoggingEnabled();
270
* setConfigLoggingEnabled
273
public void setConfigLoggingEnabled(boolean enabled);