Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.cache.aop
Class TreeCacheAop

    java.lang.Object
      org.jboss.mx.util.JBossNotificationBroadcasterSupport
          org.jboss.system.ServiceMBeanSupport
              org.jboss.cache.TreeCache
                  org.jboss.cache.aop.TreeCacheAop

All Implemented Interfaces:
  Cloneable, javax.management.MBeanRegistration, org.jgroups.MembershipListener, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean, TreeCacheAopMBean, TreeCacheMBean

public class TreeCacheAop
extends TreeCache
implements TreeCacheAopMBean

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.

Author:
  Harald Gliebe, Ben Wang

Field Summary
`protected Map` | `cachedTypes`
`static String` | `CLASS_INTERNAL`
`static Fqn` | `JBOSS_INTERNAL`

Fields inherited from class org.jboss.cache.TreeCache
`addChildMethodLocal, cache_loader, cache_loader_class, cache_loader_config, cache_loader_fetch_persistent_state, cache_loader_fetch_transient_state, cache_loader_preload, cache_loader_shared, cache_mode, channel, cluster_name, cluster_props, commitMethod, coordinator, disp, evictConfig_, eviction_policy_class, eviction_policy_provider, evictKeyValueMethodLocal, evictNodeMethodLocal, fetch_state_on_startup, getChildrenNamesMethodLocal, getKeysMethodLocal, getKeyValueMethodLocal, getNodeMethodLocal, interceptor_chain, isolationLevel, isStateSet, jndi_name, listeners, LOCAL, lock_acquisition_timeout, members, ml, prepareMethod, printMethodLocal, proxy_info, putDataEraseMethodLocal, putDataMethodLocal, putKeyValMethodLocal, releaseAllLocksMethodLocal, removeDataMethodLocal, removeKeyMethodLocal, removeNodeMethodLocal, REPL_ASYNC, repl_queue, repl_queue_interval, repl_queue_max_elements, REPL_SYNC, replicateAllMethod, replicateMethod, replication_handler, rollbackMethod, root, SEPARATOR, state_fetch_timeout, sync_commit_phase, sync_repl_timeout, sync_rollback_phase, tm, tm_lookup, tm_lookup_class, UNINITIALIZED, use_repl_queue`

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.cache.TreeCache
`_addChild, _evict, _evict, _get, _get, _getChildrenNames, _getKeys, _print, _put, _put, _put, _put, _releaseAllLocks, _remove, _remove, _remove, _remove, _remove, _remove, _remove, _removeData, _removeData, _removeData, _removeData, _replicate, _replicate, addNode, addTreeCacheListener, block, callRemoteMethods, callRemoteMethods, callRemoteMethods, commit, createCacheLoader, createInterceptorChain, createService, destroyService, determineCoordinator, dumpTransactionTable, evict, exists, exists, exists, exists, fetchState, fetchStateOnStartup, get, get, get, get, get, getCacheLoader, getCacheLoaderClass, getCacheLoaderConfig, getCacheLoaderFetchPersistentState, getCacheLoaderFetchTransientState, getCacheLoaderPreload, getCacheLoaderShared, getCacheMode, getCacheModeInternal, getChildrenNames, getChildrenNames, getClusterName, getClusterProperties, getCurrentTransaction, getCurrentTransaction, getDefaultProperties, getEvictionPolicyClass, getEvictionPolicyConfig, getEvictionThreadWakeupIntervalSeconds, getFetchStateOnStartup, getInitialStateRetrievalTimeout, getInstance, getInterceptorChain, getInterceptors, getIsolationLevel, getIsolationLevelClass, getJndiName, getKeys, getKeys, getLocalAddress, getLocalTransaction, getLockAcquisitionTimeout, getMembers, getMessageListener, getNumberOfAttributes, getNumberOfLocksHeld, getNumberOfNodes, getRemoteProxy, getReplicationHandler, getReplQueue, getReplQueueInterval, getReplQueueMaxElements, getRoot, getSyncCommitPhase, getSyncReplTimeout, getSyncRollbackPhase, getTransactionManager, getTransactionManagerLookupClass, getTransactionTable, getUseReplQueue, hasChild, invokeMethod, isCoordinator, isCrudMethod, load, lock, notifyAllNodesCreated, notifyCacheStarted, notifyCacheStopped, notifyNodeCreated, notifyNodeEvicted, notifyNodeLoaded, notifyNodeModified, notifyNodeRemoved, notifyNodeVisisted, notifyViewChange, peek, prepare, print, print, printDetails, printLockInfo, put, put, put, put, releaseAllLocks, releaseAllLocks, remove, remove, remove, remove, removeData, removeData, removeTreeCacheListener, rollback, setCacheLoader, setCacheLoaderClass, setCacheLoaderConfig, setCacheLoaderFetchPersistentState, setCacheLoaderFetchTransientState, setCacheLoaderPreload, setCacheLoaderShared, setCacheMode, setCacheMode, setClusterConfig, setClusterName, setClusterProperties, setEvictionPolicyConfig, setFetchStateOnStartup, setInitialStateRetrievalTimeout, setIsolationLevel, setIsolationLevel, setJndiName, setLockAcquisitionTimeout, setRemoteProxy, setReplicationHandler, setReplQueueInterval, setReplQueueMaxElements, setSyncCommitPhase, setSyncReplTimeout, setSyncRollbackPhase, setTransactionManagerLookup, setTransactionManagerLookupClass, setUseReplQueue, startCacheLoader, startService, stopService, string2Mode, suspect, toString, unlock, viewAccepted`

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.cache.TreeCacheMBean
`_put, _put, _put, _put, _remove, _remove, _remove, _remove, addTreeCacheListener, callRemoteMethods, callRemoteMethods, createService, destroyService, dumpTransactionTable, evict, exists, exists, exists, exists, fetchState, get, get, getCacheLoader, getCacheLoaderClass, getCacheLoaderConfig, getCacheLoaderFetchPersistentState, getCacheLoaderFetchTransientState, getCacheLoaderPreload, getCacheLoaderShared, getCacheMode, getChildrenNames, getChildrenNames, getClusterName, getClusterProperties, getEvictionPolicyClass, getEvictionThreadWakeupIntervalSeconds, getFetchStateOnStartup, getInitialStateRetrievalTimeout, getInstance, getInterceptorChain, getInterceptors, getIsolationLevel, getJndiName, getKeys, getKeys, getLocalAddress, getLockAcquisitionTimeout, getMembers, getNumberOfAttributes, getNumberOfLocksHeld, getNumberOfNodes, getRemoteProxy, getReplQueueInterval, getReplQueueMaxElements, getSyncCommitPhase, getSyncReplTimeout, getSyncRollbackPhase, getTransactionManager, getTransactionManagerLookupClass, getUseReplQueue, isCoordinator, load, print, print, printDetails, printLockInfo, put, put, put, put, releaseAllLocks, releaseAllLocks, remove, remove, remove, remove, removeData, removeData, removeTreeCacheListener, setCacheLoader, setCacheLoaderClass, setCacheLoaderConfig, setCacheLoaderFetchPersistentState, setCacheLoaderFetchTransientState, setCacheLoaderPreload, setCacheLoaderShared, setCacheMode, setClusterConfig, setClusterName, setClusterProperties, setEvictionPolicyConfig, setFetchStateOnStartup, setInitialStateRetrievalTimeout, setIsolationLevel, setJndiName, setLockAcquisitionTimeout, setRemoteProxy, setReplQueueInterval, setReplQueueMaxElements, setSyncCommitPhase, setSyncReplTimeout, setSyncRollbackPhase, setTransactionManagerLookup, setTransactionManagerLookupClass, setUseReplQueue, startService, stopService, toString`

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

### cachedTypes

    protected Map cachedTypes

### CLASS_INTERNAL

    public static final String CLASS_INTERNAL

See Also:
  Constant Field Values

### JBOSS_INTERNAL

    public static final Fqn JBOSS_INTERNAL

Constructor Detail

### TreeCacheAop

    public TreeCacheAop(String cluster_name,
                        String props,
                        long state_fetch_timeout)
                 throws Exception

### TreeCacheAop

    public TreeCacheAop()
                 throws Exception

### TreeCacheAop

    public TreeCacheAop(org.jgroups.JChannel channel)
                 throws Exception

Method Detail

### setEvictionPolicyClass

    public void setEvictionPolicyClass(String eviction_policy_class)

  Over-ride to make sure we are using an eviction policy specific to aop.

  Specified by:
    `setEvictionPolicyClass` in interface `TreeCacheAopMBean`
  Overrides:
    `setEvictionPolicyClass` in class `TreeCache`

### putObject

    public Object putObject(String fqn,
                            Object obj)
                     throws CacheException

  Insert an aop-enabled object into the cache. It will also recursively put the any sub-object that is declared as aop-capable (i.e., in `jboss-aop.xml`). Note that `List`, `Map`, `Set` attributes are aop-enabled, by default, as well.

  Specified by:
    `putObject` in interface `TreeCacheAopMBean`
  Parameters:
    `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.
  Throws:
    `CacheException`

### putObject

    public Object putObject(Fqn fqn,
                            Object obj)
                     throws CacheException

  Insert an aop-enabled object into the cache. It will also recursively put the any sub-object that is declared as aop-capable (i.e., in `jboss-aop.xml`). Note that `List`, `Map`, `Set` attributes are aop-enabled, by default, as well.

  Specified by:
    `putObject` in interface `TreeCacheAopMBean`
  Parameters:
    `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.
  Throws:
    `CacheException`

### _putObject

    public Object _putObject(Fqn fqn,
                             Object obj)
                      throws CacheException

  Parameters:
    `fqn` -
    `obj` -
  Returns:
  Throws:
    `CacheException`

### checkObjectType

    protected void checkObjectType(Object obj)

  Check whether the object type is valid. An object type is valid if it is either: aspectized, Serializable, or primitive type. Otherwise a runtime exception is thrown.

  Parameters:
    `obj` -

### checkCircularReference

    protected Fqn checkCircularReference(Fqn fqn,
                                         org.jboss.aop.InstanceAdvisor advisor,
                                         Object obj)

### handleObjectGraph

    protected Fqn handleObjectGraph(Fqn fqn,
                                    org.jboss.aop.InstanceAdvisor advisor,
                                    CachedType type,
                                    Object obj)
                             throws CacheException

  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. In this case, we will remove the current sub-object and substitue with a ref. The reference will point to an Jboss internal node where the sub-object is re-created and stored. It will also have reference counting to keep track of garbage collection.

  Parameters:
    `fqn` - Current fqn to store this sub-object
    `advisor` - The associated Advisor instance
  Returns:
    The fqn that refers to the sub-object stored in JBoss internal node.
  Throws:
    `CacheException`

### findCacheInterceptor

    protected org.jboss.aop.advice.Interceptor findCacheInterceptor(org.jboss.aop.InstanceAdvisor advisor)

### createInternalNode

    protected Fqn createInternalNode(Fqn storedFqn)

### getObject

    public Object getObject(String fqn)
                     throws CacheException

  Retrieve the aop-enabled object from the cache.

  Specified by:
    `getObject` in interface `TreeCacheAopMBean`
  Parameters:
    `fqn` - String name that associates with this node.
  Returns:
    Current content value. Null if does not exist.
  Throws:
    `CacheException`

### getObject

    public Object getObject(Fqn fqn)
                     throws CacheException

  Retrieve the aop-enabled object from the cache. Return null if object does not exist in the cache.

  Specified by:
    `getObject` in interface `TreeCacheAopMBean`
  Parameters:
    `fqn` - Instance that associates with this node.
  Returns:
    Current content value. Null if does not exist.
  Throws:
    `CacheException`

### removeObject

    public Object removeObject(String fqn)
                        throws CacheException

  Remove aop-enabled object from the cache.

  Specified by:
    `removeObject` in interface `TreeCacheAopMBean`
  Parameters:
    `fqn` - String name that associates with this node.
  Returns:
    Value object from this node.
  Throws:
    `CacheException`

### removeObject

    public Object removeObject(Fqn fqn)
                        throws CacheException

  Remove aop-enabled object from the cache.

  Specified by:
    `removeObject` in interface `TreeCacheAopMBean`
  Parameters:
    `fqn` - Instance that associates with this node.
  Returns:
    Original value object from this node.
  Throws:
    `CacheException`

### _removeObject

    protected Object _removeObject(Fqn fqn,
                                   boolean removeCacheInterceptor)
                            throws CacheException

  Throws:
    `CacheException`

### getCachedType

    public CachedType getCachedType(Class clazz)

### _put

    public Object _put(GlobalTransaction tx,
                       Fqn fqn,
                       Object key,
                       Object value,
                       boolean create_undo_ops)
                throws CacheException

  Override the base class to provide some aop specific behaviors.

  Specified by:
    `_put` in interface `TreeCacheAopMBean`
  Overrides:
    `_put` in class `TreeCache`
  Parameters:
    `fqn` -
    `key` -
    `value` -
  Returns:
    Previous value (if any)
  Throws:
    `CacheException`

### evict

    public void evict(Fqn fqn)
               throws CacheException

  Override to provide aop specific eviction.

  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.

  Specified by:
    `evict` in interface `TreeCacheAopMBean`
  Overrides:
    `evict` in class `TreeCache`
  Parameters:
    `fqn` - Will remove everythign assoicated with this fqn.
  Throws:
    `CacheException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.