|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.norther.tammi.core.base.Adaptee org.norther.tammi.core.cache.DefaultCacheClient<K,V>
K
- the type of keys maintained by the cache.V
- the type of cached values.public class DefaultCacheClient<K,V>
A default implementation of CacheClient.
Field Summary |
---|
Fields inherited from class org.norther.tammi.core.base.Adaptee |
---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
Constructor Summary | |
---|---|
DefaultCacheClient(Class<?>... clazz)
Constructs a new client. |
Method Summary | |
---|---|
void |
clearCached()
Clears all cached entries without notifying. |
void |
expireCached(long timestamp)
Expires all cached entries notifying them about expiration. |
void |
expireFraction(long timestamp,
float fraction)
Expires the specified fraction of cached entries notifying them about expiration. |
ConcurrentMap<K,V> |
getCache(boolean... create)
Gets and optionally creates the cache. |
String |
getCachedDomain()
Gets the cached domain. |
CachedMap<K,V> |
getClientCache(boolean... create)
Gets the client cache. |
long |
getExpired()
Gets the last expire timestamp. |
long |
getRefreshed()
Gets the last refresh timestamp. |
SharedCache<K,V> |
getSharedCache()
Gets the shared cache. |
ObjectName |
getSharedCacheName()
Gets the the shared cache of this client. |
void |
handleNotification(Notification notif,
Object handback)
Handle domain cache removals. |
boolean |
isCachingDisabled()
Checks whether the caching is disabled. |
void |
postmanaged()
This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time. |
void |
refresh()
Refreshes the MBean. |
void |
removeCache()
Removes the cache. |
void |
setCachingDisabled(boolean flag)
Sets the caching disabled flag. |
void |
setSharedCacheName(ObjectName cache)
Sets the shared cache of this client. |
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. |
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 |
Constructor Detail |
---|
public DefaultCacheClient(Class<?>... clazz)
clazz
- an optional shared cache class.Method Detail |
---|
public void postmanaged()
Manageable
postmanaged
in interface Manageable
postmanaged
in class Adaptee
public void unmanaged() throws Exception
Manageable
unmanaged
in interface Manageable
unmanaged
in class Adaptee
Exception
- if the adaptee refused to be unmanaged.public boolean isCachingDisabled()
CacheClient
isCachingDisabled
in interface CacheClient<K,V>
public void setCachingDisabled(boolean flag)
CacheClient
setCachingDisabled
in interface CacheClient<K,V>
flag
- the caching disabled flag.public void expireCached(long timestamp)
CacheClient
expireCached
in interface CacheClient<K,V>
timestamp
- the timestamp of the expiration.public void expireFraction(long timestamp, float fraction)
CacheClient
expireFraction
in interface CacheClient<K,V>
timestamp
- the timestamp of the expiration.fraction
- the fraction of entries to expire (0.0..1.0).public void clearCached()
CacheClient
clearCached
in interface CacheClient<K,V>
public ConcurrentMap<K,V> getCache(boolean... create)
CacheClient
getCache
in interface CacheClient<K,V>
create
- true to create a missing cache.
public void removeCache()
CacheClient
removeCache
in interface CacheClient<K,V>
public ObjectName getSharedCacheName()
CacheClient
getSharedCacheName
in interface CacheClient<K,V>
public void setSharedCacheName(ObjectName cache)
CacheClient
setSharedCacheName
in interface CacheClient<K,V>
cache
- the object name of the shared cache or a query.public void refresh()
Refreshable
refresh
in interface Refreshable
public long getRefreshed()
Refreshable
getRefreshed
in interface Refreshable
public long getExpired()
public void handleNotification(Notification notif, Object handback)
handleNotification
in interface NotificationListener
notif
- the notification.handback
- not used.public SharedCache<K,V> getSharedCache()
public CachedMap<K,V> getClientCache(boolean... create)
create
- true to create a missing cache.
public String getCachedDomain()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |