|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.mx.util.JBossNotificationBroadcasterSupport org.jboss.system.ServiceMBeanSupport org.jboss.cache.TreeCache org.jboss.cache.aop.TreeCacheAop
Implementation of the cache using dyanmic aop interceptors. The basic idea is that the caller only
uses the putObject(String,Object)
, getObject(String)
and
removeObject(String)
methods.
When putting an object into the cache, the cache essentially takes care of how the object
will be replicated. It 'breaks' the object apart to map it onto the tree, and adds an
interceptor recursively for each object reachable from the root object. Those interceptor
'know' to which part of the tree they are mapped. Whenever there is state change
("set*" interceptors), the tree is modified using the superclass. All "get*" operations
to the object are intercepted and redirected to the tree.
Bottom line is that a user simply puts any object into the cache, and the object
will be replicated to all caches in the cluster. The only requirement on cachable objects
is that they access all state through getters and setters.
Field Summary | |
protected Map |
cachedTypes
|
static String |
CLASS_INTERNAL
|
static Fqn |
JBOSS_INTERNAL
|
Fields inherited from class org.jboss.system.ServiceMBeanSupport |
log, server, SERVICE_CONTROLLER_SIG, serviceName |
Fields inherited from interface org.jboss.system.ServiceMBean |
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED |
Constructor Summary | |
TreeCacheAop()
|
|
TreeCacheAop(org.jgroups.JChannel channel)
|
|
TreeCacheAop(String cluster_name,
String props,
long state_fetch_timeout)
|
Method Summary | |
Object |
_put(GlobalTransaction tx,
Fqn fqn,
Object key,
Object value,
boolean create_undo_ops)
Override the base class to provide some aop specific behaviors. |
Object |
_putObject(Fqn fqn,
Object obj)
|
protected Object |
_removeObject(Fqn fqn,
boolean removeCacheInterceptor)
|
protected Fqn |
checkCircularReference(Fqn fqn,
org.jboss.aop.InstanceAdvisor advisor,
Object obj)
|
protected void |
checkObjectType(Object obj)
Check whether the object type is valid. |
protected Fqn |
createInternalNode(Fqn storedFqn)
|
void |
evict(Fqn fqn)
Override to provide aop specific eviction. |
protected org.jboss.aop.advice.Interceptor |
findCacheInterceptor(org.jboss.aop.InstanceAdvisor advisor)
|
CachedType |
getCachedType(Class clazz)
|
Object |
getObject(Fqn fqn)
Retrieve the aop-enabled object from the cache. |
Object |
getObject(String fqn)
Retrieve the aop-enabled object from the cache. |
protected Fqn |
handleObjectGraph(Fqn fqn,
org.jboss.aop.InstanceAdvisor advisor,
CachedType type,
Object obj)
Handle cases where there is circular, e.g., parent refers to child and child to parent, or multiple references, e.g., two objects reference the same sub-object. |
Object |
putObject(Fqn fqn,
Object obj)
Insert an aop-enabled object into the cache. |
Object |
putObject(String fqn,
Object obj)
Insert an aop-enabled object into the cache. |
Object |
removeObject(Fqn fqn)
Remove aop-enabled object from the cache. |
Object |
removeObject(String fqn)
Remove aop-enabled object from the cache. |
void |
setEvictionPolicyClass(String eviction_policy_class)
Over-ride to make sure we are using an eviction policy specific to aop. |
Methods inherited from class org.jboss.system.ServiceMBeanSupport |
create, destroy, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop |
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport |
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jboss.system.ServiceMBean |
getName, getState, getStateString, jbossInternalLifecycle |
Methods inherited from interface org.jboss.system.Service |
create, destroy, start, stop |
Field Detail |
protected Map cachedTypes
public static final String CLASS_INTERNAL
public static final Fqn JBOSS_INTERNAL
Constructor Detail |
public TreeCacheAop(String cluster_name, String props, long state_fetch_timeout) throws Exception
public TreeCacheAop() throws Exception
public TreeCacheAop(org.jgroups.JChannel channel) throws Exception
Method Detail |
public void setEvictionPolicyClass(String eviction_policy_class)
setEvictionPolicyClass
in interface TreeCacheAopMBean
setEvictionPolicyClass
in class TreeCache
public Object putObject(String fqn, Object obj) throws CacheException
jboss-aop.xml
).
Note that List
, Map
, Set
attributes are aop-enabled, by default, as well.
putObject
in interface TreeCacheAopMBean
fqn
- The fqn string name to associate with the object in the cache.obj
- aop-enabled object to be inerted into the cache. If null,
it will nullify the fqn node.
CacheException
public Object putObject(Fqn fqn, Object obj) throws CacheException
jboss-aop.xml
).
Note that List
, Map
, Set
attributes are aop-enabled, by default, as well.
putObject
in interface TreeCacheAopMBean
fqn
- The fqn instance to associate with the object in the cache.obj
- aop-enabled object to be inerted into the cache. If null,
it will nullify the fqn node.
CacheException
public Object _putObject(Fqn fqn, Object obj) throws CacheException
fqn
- obj
-
CacheException
protected void checkObjectType(Object obj)
obj
- protected Fqn checkCircularReference(Fqn fqn, org.jboss.aop.InstanceAdvisor advisor, Object obj)
protected Fqn handleObjectGraph(Fqn fqn, org.jboss.aop.InstanceAdvisor advisor, CachedType type, Object obj) throws CacheException
fqn
- Current fqn to store this sub-objectadvisor
- The associated Advisor instance
CacheException
protected org.jboss.aop.advice.Interceptor findCacheInterceptor(org.jboss.aop.InstanceAdvisor advisor)
protected Fqn createInternalNode(Fqn storedFqn)
public Object getObject(String fqn) throws CacheException
getObject
in interface TreeCacheAopMBean
fqn
- String name that associates with this node.
CacheException
public Object getObject(Fqn fqn) throws CacheException
getObject
in interface TreeCacheAopMBean
fqn
- Instance that associates with this node.
CacheException
public Object removeObject(String fqn) throws CacheException
removeObject
in interface TreeCacheAopMBean
fqn
- String name that associates with this node.
CacheException
public Object removeObject(Fqn fqn) throws CacheException
removeObject
in interface TreeCacheAopMBean
fqn
- Instance that associates with this node.
CacheException
protected Object _removeObject(Fqn fqn, boolean removeCacheInterceptor) throws CacheException
CacheException
public CachedType getCachedType(Class clazz)
public Object _put(GlobalTransaction tx, Fqn fqn, Object key, Object value, boolean create_undo_ops) throws CacheException
_put
in interface TreeCacheAopMBean
_put
in class TreeCache
fqn
- key
- value
-
CacheException
public void evict(Fqn fqn) throws CacheException
Called by eviction policy provider. Note that eviction is done only in local mode, that is, it doesn't replicate the node removal. This is will cause the replcation nodes not synchronizing, but it is ok since user is supposed to add the node again when get is null. After that, the contents will be in sync.
evict
in interface TreeCacheAopMBean
evict
in class TreeCache
fqn
- Will remove everythign assoicated with this fqn.
CacheException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |