|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.acorn.cache.CachedMapAdapter
org.norther.tammi.core.cache.DefaultCache
org.norther.tammi.core.cache.DefaultSharedCache
public class DefaultSharedCache
A default implementation of SharedCache.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary | |
|---|---|
static String |
SHARED_CACHE_NOTIF_DESCRIPTION
The notification description. |
static ModelMBeanNotificationInfo[] |
SHARED_CACHE_NOTIFICATIONS
Shared cache notifications. |
| Fields inherited from class org.norther.tammi.core.cache.DefaultCache |
|---|
DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR |
| Fields inherited from class org.norther.tammi.acorn.cache.CachedMapAdapter |
|---|
DEFAULT_EXPIRATION_SLEEP_INTERVAL, DEFAULT_EXPIRATION_TIME |
| Constructor Summary | |
|---|---|
DefaultSharedCache()
Constructs a new cache. |
|
DefaultSharedCache(int max)
Constructs a new cache with a max expiration time. |
|
DefaultSharedCache(int max,
int def)
Constructs a new cache with max and default expiration times. |
|
DefaultSharedCache(int max,
int def,
int sleep)
Constructs a new cache with max and default expiration times and expiration sleep interval. |
|
DefaultSharedCache(int max,
int def,
int sleep,
int capacity)
Constructs a new cache with max and default expiration times, an expiration sleep interval and initial capacity. |
|
DefaultSharedCache(int max,
int def,
int sleep,
int capacity,
float loadFactor)
Constructs a new cache with max and default expiration times, an expiration sleep interval, initial capacity and load factor. |
|
| Method Summary | |
|---|---|
void |
clear(String domain)
Clears the specified domain map. |
void |
clearDomains()
Clears all domain caches. |
boolean |
containsDomain(String domain)
Checks whether a domain has a cache. |
boolean |
containsKey(String domain,
Object key)
Checks a key from the specified domain map. |
boolean |
containsValue(String domain,
Object obj)
Checks a value from the specified domain map. |
Set |
domainSet()
Returns a set of defined domains. |
Set |
entrySet(String domain)
Gets an entry set from the specified domain map. |
Object |
expire(String domain,
Object key)
Expires and removes a value from the specified domain map. |
void |
expireAll(String domain)
Expires all values from the specified domain map. |
void |
expireAllDomains()
Expires all values from all domain caches. |
void |
expireFraction(String domain,
float fraction)
Expires a fraction of entries. |
Object |
get(String domain,
Object key)
Gets a value from the specified domain map. |
Object |
get(String domain,
Object key,
int freq)
Gets a value from the the specified domain map and refreshes it with a specified expiration frequency. |
int |
getDefaultExpirationTime(String domain)
Gets the default expiration time of the domain in seconds. |
CachedMap |
getDomainCache(String domain)
Gets the cache of the specified domain. |
CachedMap |
getDomainCache(String domain,
boolean create)
Gets and optionally creates the cache of the specified domain. |
int |
getExpirationLimit(String domain)
Gets the expiration limit in the domain. |
int |
getExpirationSleepInterval(String domain)
Gets the expiration sleep interval of the domain in seconds. |
float |
getExpirationThreshold(String domain)
Gets the expiration threshold in the domain. |
int |
getMaxExpirationTime(String domain)
Gets the maximum expiration time of the domain in seconds. |
MBeanNotificationInfo[] |
getNotificationInfo()
|
boolean |
isAllowExpired(String domain)
Gets the allow expired option of the domain. |
boolean |
isDiscardOverloaded(String domain)
Gets the discard overloaded option of the domain. |
boolean |
isEmpty(String domain)
Checks if the specified domain map is empty. |
Set |
keySet(String domain)
Gets a key set from the specified domain map. |
Object |
put(String domain,
Object key,
Object obj)
Puts a value to the specified domain map. |
Object |
put(String domain,
Object key,
Object obj,
int freq)
Puts a value to the specified domain map with a value specific expiration frequency. |
void |
putAll(String domain,
Map map)
Puts a map to the specified domain map. |
boolean |
refresh(String domain,
Object key)
Refreshes a value in the specified domain map. |
boolean |
refresh(String domain,
Object key,
int freq)
Refreshes a value in the specified domain map with a new frequency. |
Object |
remove(String domain,
Object key)
Removes a value from the specified domain map. |
void |
removeDomain(String domain)
Removes the specified domain. |
void |
setAllowExpired(String domain,
boolean flag)
Sets the allow expired option of the domain allowing gets of entries already expired but not yet removed by the expiration handler. |
void |
setDefaultExpirationTime(String domain,
int t)
Sets the default expiration time of the domain in seconds. |
void |
setDiscardOverloaded(String domain,
boolean flag)
Sets the discard overloaded option of the domain. |
void |
setExpirationLimit(String domain,
int c)
Sets the expiration limit in the domain. |
void |
setExpirationSleepInterval(String domain,
int t)
Sets the expiration sleep interval of the domain in seconds. |
void |
setExpirationThreshold(String domain,
float h)
Gets the expiration threshold in the domain. |
void |
setMaxExpirationTime(String domain,
int t)
Sets the maximum expiration time of the domain in seconds. |
int |
size(String domain)
Gets the size of the specified domain map. |
void |
unmanaged()
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time. |
Collection |
values(String domain)
Gets a collection of values from the specified domain map. |
| Methods inherited from class org.norther.tammi.core.cache.DefaultCache |
|---|
addNotificationListener, getMBeanDelegate, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, setAllowExpired, setDefaultExpirationTime, setDiscardOverloaded, setExpirationLimit, setExpirationSleepInterval, setExpirationThreshold, setMaxExpirationTime, toString |
| Methods inherited from class org.norther.tammi.acorn.cache.CachedMapAdapter |
|---|
add, add, clear, containsKey, containsValue, entrySet, equals, expire, expireAll, expireFraction, get, get, getDefaultExpirationTime, getExpirationLimit, getExpirationSleepInterval, getExpirationThreshold, getExpirationTimer, getMaxExpirationTime, getSwapOutHandler, hashCode, isAllowExpired, isAutoRefreshDeclined, isDiscardOverloaded, isEmpty, keySet, put, put, putAll, putIfAbsent, putIfAbsent, refresh, refresh, remove, remove, replace, replace, setAutoRefreshDeclined, setExpirationTimer, setSwapOutHandler, size, values |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.norther.tammi.acorn.cache.CachedMap |
|---|
add, add, expire, expireAll, expireFraction, get, getDefaultExpirationTime, getExpirationLimit, getExpirationSleepInterval, getExpirationThreshold, getMaxExpirationTime, isAllowExpired, isAutoRefreshDeclined, isDiscardOverloaded, put, putIfAbsent, refresh, refresh, setAllowExpired, setAutoRefreshDeclined, setDefaultExpirationTime, setDiscardOverloaded, setExpirationLimit, setExpirationSleepInterval, setExpirationThreshold, setMaxExpirationTime |
| Methods inherited from interface java.util.concurrent.ConcurrentMap |
|---|
putIfAbsent, remove, replace, replace |
| Methods inherited from interface java.util.Map |
|---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
| Methods inherited from interface javax.management.NotificationEmitter |
|---|
removeNotificationListener |
| Methods inherited from interface javax.management.NotificationBroadcaster |
|---|
addNotificationListener, removeNotificationListener |
| Field Detail |
|---|
public static final String SHARED_CACHE_NOTIF_DESCRIPTION
public static final ModelMBeanNotificationInfo[] SHARED_CACHE_NOTIFICATIONS
| Constructor Detail |
|---|
public DefaultSharedCache()
public DefaultSharedCache(int max)
max - a max expiration time (0 = default, -1 = infinite).
public DefaultSharedCache(int max,
int def)
max - a max expiration time (0 = default, -1 = infinite).def - a default expiration time (0 = default, -1 = infinite).
public DefaultSharedCache(int max,
int def,
int sleep)
max - a max expiration time (0 = default, -1 = infinite).def - a default expiration time (0 = default, -1 = infinite).sleep - an expiration sleep interval (0 = default, -1 = infinite).
public DefaultSharedCache(int max,
int def,
int sleep,
int capacity)
max - a max expiration time (0 = default, -1 = infinite).def - a default expiration time (0 = default, -1 = infinite).sleep - an expiration sleep interval (0 = default, -1 = infinite).capacity - an initial capacity.
public DefaultSharedCache(int max,
int def,
int sleep,
int capacity,
float loadFactor)
max - a max expiration time (0 = default, -1 = infinite).def - a default expiration time (0 = default, -1 = infinite).sleep - an expiration sleep interval (0 = default, -1 = infinite).capacity - an initial capacity.loadFactor - a load factor.| Method Detail |
|---|
public void unmanaged()
throws Exception
Manageable
unmanaged in interface Manageableunmanaged in class DefaultCacheException - if the adaptee refused to be unmanaged.public boolean isAllowExpired(String domain)
SharedCache
isAllowExpired in interface SharedCachedomain - the domain.
public void setAllowExpired(String domain,
boolean flag)
SharedCache
setAllowExpired in interface SharedCachedomain - the domain.flag - the allow expired option.public boolean isDiscardOverloaded(String domain)
SharedCache
isDiscardOverloaded in interface SharedCachedomain - the domain.
public void setDiscardOverloaded(String domain,
boolean flag)
SharedCache
setDiscardOverloaded in interface SharedCachedomain - the domain.flag - true if new puts are discarded if overloaded, false
otherwise.public int getMaxExpirationTime(String domain)
SharedCache
getMaxExpirationTime in interface SharedCachedomain - the domain.
public void setMaxExpirationTime(String domain,
int t)
SharedCache
setMaxExpirationTime in interface SharedCachedomain - the domain.t - the secs.public int getDefaultExpirationTime(String domain)
SharedCache
getDefaultExpirationTime in interface SharedCachedomain - the domain.
public void setDefaultExpirationTime(String domain,
int t)
SharedCache
setDefaultExpirationTime in interface SharedCachedomain - the domain.t - the secs.public int getExpirationSleepInterval(String domain)
SharedCache
getExpirationSleepInterval in interface SharedCachedomain - the domain.
public void setExpirationSleepInterval(String domain,
int t)
SharedCache
setExpirationSleepInterval in interface SharedCachedomain - the domain.t - the secspublic int getExpirationLimit(String domain)
SharedCache
getExpirationLimit in interface SharedCachedomain - the domain.
public void setExpirationLimit(String domain,
int c)
SharedCache
setExpirationLimit in interface SharedCachedomain - the domain.c - the limit.public float getExpirationThreshold(String domain)
SharedCache
getExpirationThreshold in interface SharedCachedomain - the domain.
public void setExpirationThreshold(String domain,
float h)
SharedCache
setExpirationThreshold in interface SharedCachedomain - the domain.h - the threshold.public void clear(String domain)
SharedCache
clear in interface SharedCachedomain - the domain.
public boolean containsKey(String domain,
Object key)
SharedCache
containsKey in interface SharedCachedomain - the domain.key - the key to check.
public boolean containsValue(String domain,
Object obj)
SharedCache
containsValue in interface SharedCachedomain - the domain.obj - the value to check.
public Set entrySet(String domain)
SharedCache
entrySet in interface SharedCachedomain - the domain.
public Set keySet(String domain)
SharedCache
keySet in interface SharedCachedomain - the domain.
public Collection values(String domain)
SharedCache
values in interface SharedCachedomain - the domain.
public Object get(String domain,
Object key)
SharedCache
get in interface SharedCachedomain - the domain.key - the key.
public Object put(String domain,
Object key,
Object obj)
SharedCache
put in interface SharedCachedomain - the domain.key - the key.obj - the value.
public void putAll(String domain,
Map map)
SharedCache
putAll in interface SharedCachedomain - the domain.map - the map.
public Object remove(String domain,
Object key)
SharedCache
remove in interface SharedCachedomain - the domain.key - the key.
public int size(String domain)
SharedCache
size in interface SharedCachedomain - the domain.
public boolean isEmpty(String domain)
SharedCache
isEmpty in interface SharedCachedomain - the domain.
public Object get(String domain,
Object key,
int freq)
SharedCache
get in interface SharedCachedomain - the domain.key - the key.freq - the expiration frequency.
public Object put(String domain,
Object key,
Object obj,
int freq)
SharedCache
put in interface SharedCachedomain - the domain.key - the key.obj - the value.freq - the expiration frequency.
public boolean refresh(String domain,
Object key)
SharedCache
refresh in interface SharedCachedomain - the domain.key - the key.
public boolean refresh(String domain,
Object key,
int freq)
SharedCache
refresh in interface SharedCachedomain - the domain.key - the key.freq - the expiration frequency.
public Object expire(String domain,
Object key)
SharedCache
expire in interface SharedCachedomain - the domain.key - the key.
public void expireAll(String domain)
SharedCache
expireAll in interface SharedCachedomain - the domain.
public void expireFraction(String domain,
float fraction)
SharedCache
expireFraction in interface SharedCachedomain - the domain.fraction - the fraction to expire (0.0..1.0).public CachedMap getDomainCache(String domain)
SharedCache
getDomainCache in interface SharedCachedomain - the domain.
public CachedMap getDomainCache(String domain,
boolean create)
SharedCache
getDomainCache in interface SharedCachedomain - the domain.create - true to create a missing cache.
public boolean containsDomain(String domain)
SharedCache
containsDomain in interface SharedCachedomain - the domain.
public void removeDomain(String domain)
SharedCache
removeDomain in interface SharedCachedomain - the domain.public Set domainSet()
SharedCache
domainSet in interface SharedCachepublic void clearDomains()
SharedCache
clearDomains in interface SharedCachepublic void expireAllDomains()
SharedCache
expireAllDomains in interface SharedCachepublic MBeanNotificationInfo[] getNotificationInfo()
getNotificationInfo in interface NotificationBroadcastergetNotificationInfo in class DefaultCache
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||