|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.mx.util.JBossNotificationBroadcasterSupport
org.jboss.system.ServiceMBeanSupport
org.jboss.cache.TreeCache
org.jboss.cache.aop.TreeCacheAop
public class TreeCacheAop
Implementation of the cache using dynamic 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 java.util.Map |
cachedTypes
|
protected TreeCacheAopDelegate |
delegate_
|
static java.lang.String |
DUMMY
|
Fields inherited from class org.jboss.system.ServiceMBeanSupport |
---|
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(java.lang.String cluster_name,
java.lang.String props,
long state_fetch_timeout)
|
Method Summary | |
---|---|
protected java.lang.Object |
_evictObject(Fqn fqn)
|
protected void |
_evictSubtree(Fqn subtree)
Evicts the node at subtree along with all descendant nodes. |
protected java.util.Map |
_findObjects(Fqn fqn)
|
protected java.lang.Object |
_getObject(Fqn fqn)
|
protected java.lang.Object |
_putObject(Fqn fqn,
java.lang.Object obj)
|
protected java.lang.Object |
_removeObject(Fqn fqn,
boolean removeCacheInterceptor)
|
protected void |
acquireLocksForStateTransfer(DataNode root,
java.lang.Object lockOwner,
long timeout,
boolean force)
Overrides the superclass version by additionally acquiring locks on the internal reference map nodes used for tracking shared objects. |
void |
activateRegion(java.lang.String subtreeFqn)
Overrides the superclass method by
ensuring that the internal region where information on shared object is stored
has been activated. |
protected void |
endTransaction(Fqn fqn)
|
void |
evict(Fqn fqn)
Override to provide aop specific eviction. |
java.util.Map |
findObjects(Fqn fqn)
Query all managed pojo objects under the fqn recursively. |
java.util.Map |
findObjects(java.lang.String fqn)
Query all managed pojo objects under the fqn recursively. |
CachedType |
getCachedType(java.lang.Class clazz)
Obtain a cache aop type for user to traverse the defined "primitive" types in aop. |
java.lang.Object |
getObject(Fqn fqn)
Retrieve the aop-enabled object from the cache. |
java.lang.Object |
getObject(java.lang.String fqn)
Retrieve the aop-enabled object from the cache. |
protected boolean |
hasCurrentTransaction()
|
protected void |
init()
|
java.lang.Object |
putObject(Fqn fqn,
java.lang.Object obj)
Insert an aop-enabled object into the cache. |
java.lang.Object |
putObject(java.lang.String fqn,
java.lang.Object obj)
Insert an aop-enabled object into the cache. |
protected void |
releaseStateTransferLocks(DataNode root,
java.lang.Object lockOwner)
Overrides the superclass version by additionally releasing locks on the internal reference map nodes used for tracking shared objects. |
java.lang.Object |
removeObject(Fqn fqn)
Remove aop-enabled object from the cache. |
java.lang.Object |
removeObject(java.lang.String fqn)
Remove aop-enabled object from the cache. |
void |
setEvictionPolicyClass(java.lang.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, getDeploymentInfo, 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, nextNotificationSequenceNumber, 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 java.util.Map cachedTypes
public static final java.lang.String DUMMY
protected TreeCacheAopDelegate delegate_
Constructor Detail |
---|
public TreeCacheAop(java.lang.String cluster_name, java.lang.String props, long state_fetch_timeout) throws java.lang.Exception
java.lang.Exception
public TreeCacheAop() throws java.lang.Exception
java.lang.Exception
public TreeCacheAop(org.jgroups.JChannel channel) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
protected void init()
public void setEvictionPolicyClass(java.lang.String eviction_policy_class)
setEvictionPolicyClass
in interface TreeCacheAopMBean
setEvictionPolicyClass
in interface TreeCacheMBean
setEvictionPolicyClass
in class TreeCache
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 interface TreeCacheMBean
evict
in class TreeCache
fqn
- Will remove everythign assoicated with this fqn.
CacheException
protected void _evictSubtree(Fqn subtree) throws CacheException
TreeCache
subtree
along with all descendant nodes.
_evictSubtree
in class TreeCache
subtree
- Fqn indicating the uppermost node in the
portion of the tree that should be evicted.
CacheException
public void activateRegion(java.lang.String subtreeFqn) throws RegionNotEmptyException, RegionNameConflictException, CacheException
superclass method
by
ensuring that the internal region where information on shared object is stored
has been activated.
activateRegion
in interface TreeCacheMBean
activateRegion
in class TreeCache
subtreeFqn
- Fqn string indicating the uppermost node in the
portion of the tree that should be activated.
RegionNotEmptyException
- if the node subtreeFqn
exists and has either data or children
RegionNameConflictException
CacheException
protected void acquireLocksForStateTransfer(DataNode root, java.lang.Object lockOwner, long timeout, boolean force) throws java.lang.Exception
java.lang.Exception
protected void releaseStateTransferLocks(DataNode root, java.lang.Object lockOwner)
public CachedType getCachedType(java.lang.Class clazz)
getCachedType
in interface TreeCacheAopMBean
clazz
- The original pojo class
public java.lang.Object getObject(java.lang.String fqn) throws CacheException
getObject
in interface TreeCacheAopIfc
getObject
in interface TreeCacheAopMBean
fqn
- String name that associates with this node.
CacheException
public java.lang.Object getObject(Fqn fqn) throws CacheException
getObject
in interface TreeCacheAopIfc
getObject
in interface TreeCacheAopMBean
fqn
- Instance that associates with this node.
CacheException
public java.lang.Object putObject(java.lang.String fqn, java.lang.Object obj) throws CacheException
jboss-aop.xml
).
Note that List
, Map
, Set
attributes are aop-enabled, by default, as well.
putObject
in interface TreeCacheAopIfc
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.obj
- Return the previous content under fqn.
CacheException
public java.lang.Object putObject(Fqn fqn, java.lang.Object obj) throws CacheException
jboss-aop.xml
).
Note that List
, Map
, Set
attributes are aop-enabled, by default, as well.
putObject
in interface TreeCacheAopIfc
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.obj
- Return the previous content under fqn.
CacheException
public java.lang.Object removeObject(java.lang.String fqn) throws CacheException
removeObject
in interface TreeCacheAopIfc
removeObject
in interface TreeCacheAopMBean
fqn
- String name that associates with this node.
CacheException
public java.lang.Object removeObject(Fqn fqn) throws CacheException
removeObject
in interface TreeCacheAopIfc
removeObject
in interface TreeCacheAopMBean
fqn
- Instance that associates with this node.
CacheException
public java.util.Map findObjects(java.lang.String fqn) throws CacheException
findObjects
in interface TreeCacheAopMBean
fqn
- The starting place to find all pojos.
CacheException
public java.util.Map findObjects(Fqn fqn) throws CacheException
findObjects
in interface TreeCacheAopMBean
fqn
- The starting place to find all pojos.
CacheException
protected boolean hasCurrentTransaction()
protected void endTransaction(Fqn fqn)
protected java.lang.Object _getObject(Fqn fqn) throws CacheException
CacheException
protected java.lang.Object _putObject(Fqn fqn, java.lang.Object obj) throws CacheException
CacheException
protected java.lang.Object _removeObject(Fqn fqn, boolean removeCacheInterceptor) throws CacheException
CacheException
protected java.lang.Object _evictObject(Fqn fqn) throws CacheException
CacheException
protected java.util.Map _findObjects(Fqn fqn) throws CacheException
CacheException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |