|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.base.Adaptee
org.norther.tammi.core.thread.DefaultExecutable
org.norther.tammi.core.monitor.DefaultCacheMonitor
public class DefaultCacheMonitor
The default implementation of CacheMonitor. The cache controlling methods do not affect the CacheMonitor itself.
| Field Summary |
|---|
| Fields inherited from class org.norther.tammi.core.base.Adaptee |
|---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
| Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate |
|---|
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE |
| Constructor Summary | |
|---|---|
DefaultCacheMonitor()
|
|
| Method Summary | |
|---|---|
void |
clearCached()
Clears cached entries in all registered CacheClientMBeans without notifying. |
void |
expireCached(long timestamp)
Expires cached entries in all registered CacheClients notifying them about expiration. |
void |
expireFraction(long timestamp,
float frac)
Expires a fraction of cached entries in all registered CacheClients notifying them about expiration. |
void |
gc()
Runs the garbage collector. |
ConcurrentMap |
getCache(boolean create)
Gets the client cache which is always null for CacheMonitor. |
float |
getExpirationFraction()
Gets the fraction of cached entries to expire when running low in memory. |
long |
getExpirationThreshold()
Gets the threshold of available memory below which caches are expired. |
long |
getFreeMemory()
Gets the amount of free memory in bytes. |
long |
getMaxMemory()
Gets max amount of memory in bytes. |
long |
getRefreshed()
Gets the last refresh timestamp. |
long |
getTotalMemory()
Gets total amount of memory in bytes. |
boolean |
isCachingDisabled()
Checks whether any registered CacheClientMBean has caching disabled. |
String |
logMemoryStatus()
Logs memory status using the info logger. |
void |
refresh()
Refreshes the MBean. |
void |
removeCache()
Removes the cache which is always null for CacheMonitor. |
void |
run()
A thread polling freed references (no need for internal synchronizations as Executable takes care of running this method only in one thread at a time). |
void |
setCachingDisabled(boolean flag)
Sets the caching disabled flag for all registered CacheClientMBeans. |
void |
setExpirationFraction(float frac)
Sets the fraction of cached entries to expire when running low in memory. |
void |
setExpirationThreshold(long thresh)
Sets the threshold of available memory below which caches are expired. |
| Methods inherited from class org.norther.tammi.core.thread.DefaultExecutable |
|---|
getExecutor, getExecutorName, isStarted, postmanaged, setExecutorName, start, stop, unmanaged |
| Methods inherited from class org.norther.tammi.core.base.Adaptee |
|---|
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.norther.tammi.core.thread.Executable |
|---|
getExecutorName, setExecutorName |
| Methods inherited from interface org.norther.tammi.core.base.Startable |
|---|
isStarted, start, stop |
| Constructor Detail |
|---|
public DefaultCacheMonitor()
| Method Detail |
|---|
public boolean isCachingDisabled()
isCachingDisabled in interface CacheClientpublic void setCachingDisabled(boolean flag)
setCachingDisabled in interface CacheClientflag - the caching disabled flag.public void expireCached(long timestamp)
expireCached in interface CacheClienttimestamp - the timestamp of the expiration.
public void expireFraction(long timestamp,
float frac)
expireFraction in interface CacheClienttimestamp - the timestamp of the expiration.frac - the fraction of entries to expire.public void clearCached()
clearCached in interface CacheClientpublic ConcurrentMap getCache(boolean create)
getCache in interface CacheClientcreate - ignored.
public void removeCache()
removeCache in interface CacheClientpublic void refresh()
Refreshable
refresh in interface Refreshablepublic long getRefreshed()
Refreshable
getRefreshed in interface Refreshablepublic long getMaxMemory()
CacheMonitor
getMaxMemory in interface CacheMonitorpublic long getTotalMemory()
CacheMonitor
getTotalMemory in interface CacheMonitorpublic long getFreeMemory()
CacheMonitor
getFreeMemory in interface CacheMonitorpublic long getExpirationThreshold()
CacheMonitor
getExpirationThreshold in interface CacheMonitorpublic void setExpirationThreshold(long thresh)
CacheMonitor
setExpirationThreshold in interface CacheMonitorthresh - the cache expiration threshold in bytes.public float getExpirationFraction()
CacheMonitor
getExpirationFraction in interface CacheMonitorpublic void setExpirationFraction(float frac)
CacheMonitor
setExpirationFraction in interface CacheMonitorfrac - the cache expiration fraction (0.0..1.0).public String logMemoryStatus()
CacheMonitor
logMemoryStatus in interface CacheMonitorpublic void gc()
CacheMonitor
gc in interface CacheMonitorpublic void run()
A freed soft reference indicates that memory is running out and therefore caches are expired in this case.
run in interface Runnablerun in class DefaultExecutable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||