org.jboss.cache
Class TreeCache

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.cache.TreeCache
All Implemented Interfaces:
java.lang.Cloneable, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, TreeCacheMBean, org.jboss.system.Service, org.jboss.system.ServiceMBean, org.jgroups.MembershipListener
Direct Known Subclasses:
MarshalledTreeCache, RpcTreeCache, TreeCacheAop

public class TreeCache
extends org.jboss.system.ServiceMBeanSupport
implements TreeCacheMBean, java.lang.Cloneable, org.jgroups.MembershipListener

A tree-like structure that is replicated across several members. Updates will be multicast to all group members reliably and in the same order. User has the option to set transaction isolation level now (e.g., SERIALIZABLE, or REPEATABLE_READ.

Version:
$Id: TreeCache.java,v 1.142 2006/04/01 00:45:38 genman Exp $

Author:
Bela Ban, Ben Wang, Manik Surtani (manik@jboss.org), Brian Stansberry, Daniel Huang (dhuang@jboss.org)

Field Summary
protected  java.util.Set activationChangeNodes
          Set of Fqns of nodes that are currently being processed by activateReqion or inactivateRegion.
static java.lang.reflect.Method addChildMethodLocal
           
protected  int cache_mode
           
protected  org.w3c.dom.Element cacheLoaderConfig
          The XML Element from which to configure the CacheLoader
protected  CacheLoaderManager cacheLoaderManager
           
protected  org.jgroups.JChannel channel
           
protected  CacheLoaderConfig cloaderConfig
          for legacy use *
protected  java.lang.String cluster_name
           
protected  java.lang.String cluster_props
           
static java.lang.reflect.Method clusteredGetMethod
           
static java.lang.reflect.Method commitMethod
           
protected  boolean coordinator
          Am I the coordinator ?
static short DEFAULT_REPLICATION_VERSION
           
protected  org.jgroups.blocks.RpcDispatcher disp
           
static java.lang.reflect.Method enqueueMethodCallMethod
           
protected  org.w3c.dom.Element evictConfig_
          Eviction policy configuration in xml Element
protected  java.lang.String eviction_policy_class
           
protected  EvictionPolicy eviction_policy_provider
          Deprecated. DO NOT USE THIS. IT IS HERE FOR EJB3 COMPILATION COMPATIBILITY WITH JBOSSCACHE1.3
protected  RegionManager evictionRegionManager_
          RegionManager used by cache eviction
static java.lang.reflect.Method evictNodeMethodLocal
           
static java.lang.reflect.Method evictVersionedNodeMethodLocal
           
static java.lang.reflect.Method existsMethod
           
protected  boolean fetchInMemoryState
           
static java.lang.reflect.Method getChildrenNamesMethodLocal
           
static java.lang.reflect.Method getDataMapMethodLocal
           
static java.lang.reflect.Method getKeysMethodLocal
           
static java.lang.reflect.Method getKeyValueMethodLocal
           
static java.lang.reflect.Method getNodeMethodLocal
           
static java.lang.reflect.Method getPartialStateMethod
           
protected  boolean hasListeners
           
protected  boolean inactiveOnStartup
           
protected  Interceptor interceptor_chain
          invokeMethod(MethodCall) will dispatch to this chain of interceptors.
static int INVALIDATION_ASYNC
          Cache sends evict() calls to remote caches when a node is changed.
static int INVALIDATION_SYNC
          Cache sends evict() calls to remote caches when a node is changed.
protected  IsolationLevel isolationLevel
           
protected  boolean isStandalone
           
protected  boolean isStateSet
           
static int LOCAL
          Entries in the cache are by default local; ie.
protected  long lock_acquisition_timeout
           
static java.lang.reflect.Method lockMethodLocal
           
protected static org.apache.commons.logging.Log log
           
protected  TreeCacheMarshaller marshaller_
          Marshaller if register to handle marshalling
protected  java.util.Vector members
           
protected  org.jgroups.MessageListener ml
           
protected  boolean nodeLockingOptimistic
          Determines whether to use optimistic locking or not.
static java.lang.reflect.Method notifyCallOnInactiveMethod
           
static java.lang.reflect.Method optimisticPrepareMethod
           
static java.lang.reflect.Method prepareMethod
           
static java.lang.reflect.Method printMethodLocal
           
static java.lang.reflect.Method putDataEraseMethodLocal
           
static java.lang.reflect.Method putDataMethodLocal
           
static java.lang.reflect.Method putFailFastKeyValueMethodLocal
           
static java.lang.reflect.Method putKeyValMethodLocal
           
protected  java.util.Map region_msg_queues
           
protected  RegionManager regionManager_
          RegionManager used by marshaller and ExtendedCacheLoader
static java.lang.reflect.Method releaseAllLocksMethodLocal
           
static java.lang.reflect.Method removeDataMethodLocal
           
static java.lang.reflect.Method removeKeyMethodLocal
           
static java.lang.reflect.Method removeNodeMethodLocal
           
static int REPL_ASYNC
          Entries in the cache are by default replicated (asynchronously)
protected  ReplicationQueue repl_queue
          Queue used to replicate updates when mode is repl-async
protected  long repl_queue_interval
           
protected  int repl_queue_max_elements
           
static int REPL_SYNC
          Entries in the cache are by default replicated (synchronously)
static java.lang.reflect.Method replicateAllMethod
           
static java.lang.reflect.Method replicateMethod
           
protected  Replicatable replication_handler
           
static java.lang.reflect.Method rollbackMethod
           
protected  DataNode root
           
static java.lang.String SEPARATOR
           
protected  java.lang.Exception setStateException
           
protected  long state_fetch_timeout
           
protected  boolean sync_commit_phase
          synchronous or asynchrous commit phase ?
protected  long sync_repl_timeout
           
protected  boolean sync_rollback_phase
          synchronous or asynchrous rollback phase ?
protected  javax.transaction.TransactionManager tm
          Used to get the Transaction associated with the current thread
protected  TransactionManagerLookup tm_lookup
          Method to acquire a TransactionManager.
protected  java.lang.String tm_lookup_class
          Class of the implementation of TransactionManagerLookup
static java.lang.String UNINITIALIZED
           
protected  boolean use_interceptor_mbeans
           
protected  boolean use_repl_queue
           
protected  boolean useCreateService
           
protected  boolean useMarshalling_
          Check to see if we need to use marshalling
 
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
TreeCache()
           
TreeCache(org.jgroups.JChannel channel)
          Expects an already connected channel.
TreeCache(java.lang.String cluster_name, java.lang.String props, long state_fetch_timeout)
          Creates a channel with the given properties.
 
Method Summary
 void _addChild(GlobalTransaction tx, Fqn parent_fqn, java.lang.Object child_name, DataNode old_node)
          Compensating method to _remove(GlobalTransaction,Fqn,boolean).
 java.util.List _clusteredGet(org.jgroups.blocks.MethodCall call)
          A 'clustered get' call, received from a remote ClusteredCacheLoader.
protected  void _createService()
           
 void _enqueueMethodCall(java.lang.String subtree, org.jgroups.blocks.MethodCall call)
           
 void _evict(Fqn fqn)
          Called by eviction policy provider.
 void _evict(Fqn fqn, DataVersion version)
          // TODO: MANIK: Document this methodcall
protected  void _evictSubtree(Fqn subtree)
          Evicts the node at subtree along with all descendant nodes.
 Node _get(Fqn fqn)
           
 java.lang.Object _get(Fqn fqn, java.lang.Object key, boolean sendNodeEvent)
           
protected  byte[] _getAssociatedState(Fqn fqn, long timeout, boolean force)
          Returns any state stored in the cache that needs to be propagated along with the normal transient state in a subtree when _getState(Fqn, long, boolean, boolean) is called for an Fqn.
 java.util.Set _getChildrenNames(Fqn fqn)
           
 java.util.Map _getData(Fqn fqn)
           
 java.util.Set _getKeys(Fqn fqn)
           
 byte[] _getState(Fqn fqn, long timeout, boolean force, boolean suppressErrors)
          Returns the state for the portion of the tree named by fqn.
 void _lock(Fqn fqn, int lock_type, boolean recursive)
           
 java.lang.String _print(Fqn fqn)
           
 void _put(GlobalTransaction tx, Fqn fqn, java.util.Map data, boolean create_undo_ops)
          Does the real work.
 void _put(GlobalTransaction tx, Fqn fqn, java.util.Map data, boolean create_undo_ops, boolean erase_contents)
          Does the real work.
 java.lang.Object _put(GlobalTransaction tx, Fqn fqn, java.lang.Object key, java.lang.Object value, boolean create_undo_ops)
           
 java.lang.Object _put(GlobalTransaction tx, Fqn fqn, java.lang.Object key, java.lang.Object value, boolean create_undo_ops, long timeout)
           
 void _put(GlobalTransaction tx, java.lang.String fqn, java.util.Map data, boolean create_undo_ops)
          Does the real work.
 java.lang.Object _put(GlobalTransaction tx, java.lang.String fqn, java.lang.Object key, java.lang.Object value, boolean create_undo_ops)
           
 void _releaseAllLocks(Fqn fqn)
           
 void _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops)
           
 void _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent)
           
 void _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction)
          Remove a node
 void _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction, DataVersion version)
          // TODO: MANIK: Document this methodcall
 java.lang.Object _remove(GlobalTransaction tx, Fqn fqn, java.lang.Object key, boolean create_undo_ops)
           
 void _remove(GlobalTransaction tx, java.lang.String fqn, boolean create_undo_ops)
           
 java.lang.Object _remove(GlobalTransaction tx, java.lang.String fqn, java.lang.Object key, boolean create_undo_ops)
           
 void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops)
           
 void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent)
           
 void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction)
           
 void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction, DataVersion version)
           
 void _removeData(GlobalTransaction tx, java.lang.String fqn, boolean create_undo_ops)
           
 void _replicate(java.util.List method_calls)
           
 java.lang.Object _replicate(org.jgroups.blocks.MethodCall method_call)
          Invoked by the ReplicationInterceptor of other nodes in the cluster, to replicate their changes across the cluster.
protected  void acquireLocksForStateTransfer(DataNode root, java.lang.Object lockOwner, long timeout, boolean lockChildren, boolean force)
           
 void activateRegion(java.lang.String subtreeFqn)
          Causes the cache to transfer state for the subtree rooted at subtreeFqn and to begin accepting replication messages for that subtree.
 void addTreeCacheListener(TreeCacheListener listener)
           
 void addUndoOperation(GlobalTransaction gtx, org.jgroups.blocks.MethodCall undo_op)
           
 void block()
          Block sending and receiving of messages until viewAccepted() is called
 java.util.List callRemoteMethods(java.util.Vector mbrs, org.jgroups.blocks.MethodCall method_call, boolean synchronous, boolean exclude_self, long timeout)
          Deprecated. Note this is due to be moved to an interceptor.
 java.util.List callRemoteMethods(java.util.Vector mbrs, org.jgroups.blocks.MethodCall method_call, int mode, boolean exclude_self, long timeout)
          Deprecated. Note this is due to be moved to an interceptor.
 java.util.List callRemoteMethods(java.util.Vector members, java.lang.reflect.Method method, java.lang.Object[] args, boolean synchronous, boolean exclude_self, long timeout)
          Deprecated. Note this is due to be moved to an interceptor.
 java.util.List callRemoteMethods(java.util.Vector members, java.lang.String method_name, java.lang.Class[] types, java.lang.Object[] args, boolean synchronous, boolean exclude_self, long timeout)
          Deprecated. Note this is due to be moved to an interceptor.
 void commit(GlobalTransaction tx)
           
 void createService()
          Lifecycle method.
protected  DataNode createSubtreeRootNode(Fqn subtree)
           
 void destroyService()
          Lifecycle mthod.
protected  boolean determineCoordinator()
           
 java.lang.String dumpTransactionTable()
          Dumps the contents of the TransactionTable
 void evict(Fqn fqn)
          Called by eviction policy provider.
 boolean exists(Fqn fqn)
          Checks whether a given node exists in the tree.
 boolean exists(Fqn fqn, java.lang.Object key)
          Checks whether a given key exists in the given node.
 boolean exists(java.lang.String fqn)
          Checks whether a given node exists in the tree
 boolean exists(java.lang.String fqn, java.lang.Object key)
           
 void fetchState(long timeout)
          Fetch the group state from the current coordinator.
protected  void fetchStateOnStartup()
           
protected  void forceAcquireLock(DataNode node, java.lang.Object newOwner, boolean lockChildren)
          Forcibly acquire a read lock on the given node for the given owner, breaking any existing locks that prevent the read lock.
 Node get(Fqn fqn)
           
 java.lang.Object get(Fqn fqn, java.lang.Object key)
          Finds a node given its name and returns the value associated with a given key in its data map.
protected  java.lang.Object get(Fqn fqn, java.lang.Object key, boolean sendNodeEvent)
           
 java.lang.Object get(Fqn fqn, java.lang.Object key, boolean sendNodeEvent, Option option)
          The same as calling get(Fqn, Object, boolean) except that you can pass in options for this specific method invocation.
 java.lang.Object get(Fqn fqn, java.lang.Object key, Option option)
          The same as calling get(Fqn, Object) except that you can pass in options for this specific method invocation.
 DataNode get(Fqn fqn, Option option)
          The same as calling get(Fqn) except that you can pass in options for this specific method invocation.
 Node get(java.lang.String fqn)
           
 java.lang.Object get(java.lang.String fqn, java.lang.Object key)
          Finds a node given its name and returns the value associated with a given key in its data map.
 CacheLoader getCacheLoader()
           
 boolean getCacheLoaderAsynchronous()
          Deprecated.  
 java.lang.String getCacheLoaderClass()
          Deprecated.  
 java.util.Properties getCacheLoaderConfig()
          provided for backward compat.
 org.w3c.dom.Element getCacheLoaderConfiguration()
           
 boolean getCacheLoaderFetchPersistentState()
          Deprecated.  
 boolean getCacheLoaderFetchTransientState()
          Deprecated.  
 CacheLoaderManager getCacheLoaderManager()
           
 boolean getCacheLoaderPassivation()
          Deprecated.  
 java.lang.String getCacheLoaderPreload()
          Deprecated.  
 boolean getCacheLoaderShared()
          Deprecated.  
 java.lang.String getCacheMode()
          Returns the current caching mode.
 int getCacheModeInternal()
           
 java.util.Set getChildrenNames(Fqn fqn)
          Returns all children of a given node
 java.util.Set getChildrenNames(Fqn fqn, Option option)
          The same as calling getChildrenNames(Fqn) except that you can pass in options for this specific method invocation.
 java.util.Set getChildrenNames(java.lang.String fqn)
          Returns all children of a given node
 java.lang.String getClusterName()
          Get the name of the replication group
 java.lang.String getClusterProperties()
          Get the cluster properties (e.g.
 org.jgroups.Address getCoordinator()
           
 GlobalTransaction getCurrentTransaction()
          Get the transaction associated with the current thread and maps it onto a GlobalTransaction.
 GlobalTransaction getCurrentTransaction(boolean createIfNotExists)
           
 GlobalTransaction getCurrentTransaction(javax.transaction.Transaction tx)
           
 GlobalTransaction getCurrentTransaction(javax.transaction.Transaction tx, boolean createIfNotExists)
           
 boolean getDeadlockDetection()
          Deprecated.  
protected  java.lang.String getDefaultProperties()
           
 java.lang.String getEvictionPolicyClass()
          Returns the name of the cache eviction policy (must be an implementation of EvictionPolicy)
 org.w3c.dom.Element getEvictionPolicyConfig()
           
 RegionManager getEvictionRegionManager()
           
 int getEvictionThreadWakeupIntervalSeconds()
          Obtain eviction thread (if any) wake up interval in seconds
 boolean getFetchInMemoryState()
          Returns whether or not any initial state transfer or subsequent partial state transfer following an activateRegion call should include in-memory state.
 boolean getFetchStateOnStartup()
          Returns whether or not on startup the initial state will be acquired from existing members.
 long getInitialStateRetrievalTimeout()
          Get the max time to wait until the initial state is retrieved.
 TreeCache getInstance()
          Returns a reference to the TreeCache object itself.
 java.lang.String getInterceptorChain()
           
 java.util.List getInterceptors()
           
 InvocationContext getInvocationContext()
          Retrieves an InvocationContext.
 java.lang.String getIsolationLevel()
          Returns the transaction isolation level.
 IsolationLevel getIsolationLevelClass()
           
 java.util.Set getKeys(Fqn fqn)
           
 java.util.Set getKeys(java.lang.String fqn)
           
 java.lang.Object getLocalAddress()
           
protected  javax.transaction.Transaction getLocalTransaction()
          Returns the transaction associated with the current thread.
 long getLockAcquisitionTimeout()
          Default max time to wait for a lock.
 java.util.Map getLockTable()
           
 java.util.Vector getMembers()
           
 org.jgroups.MessageListener getMessageListener()
           
 java.lang.String getNodeLockingScheme()
           
 int getNumberOfAttributes()
          Returns an approximation of the total number of attributes in the tree.
 int getNumberOfAttributes(Fqn fqn)
           
 int getNumberOfLocksHeld()
          Gets the number of read or write locks held across the entire tree
 int getNumberOfNodes()
          Returns an approximation of the total number of nodes in the tree.
protected  java.lang.Object getOwnerForLock()
          Returns an object suitable for use in node locking, either the current transaction or the current thread if there is no transaction.
 RegionManager getRegionManager()
           
 java.lang.String getReplicationVersion()
          Gets the format version of the data transferred during an initial state transfer or a call to TreeCacheMBean.activateRegion(String).
 short getReplicationVersionShort()
           
 ReplicationQueue getReplQueue()
           
 long getReplQueueInterval()
           
 int getReplQueueMaxElements()
           
 DataNode getRoot()
          Used by interceptors.
 byte[] getStateBytes()
           
 short getStateTransferVersion()
          Gets the format version of the data transferred during an initial state transfer or a call to TreeCacheMBean.activateRegion(String).
 boolean getSyncCommitPhase()
           
 long getSyncReplTimeout()
          Returns the default max timeout after which synchronous replication calls return.
 boolean getSyncRollbackPhase()
           
 javax.transaction.TransactionManager getTransactionManager()
           
 java.lang.String getTransactionManagerLookupClass()
           
 TransactionTable getTransactionTable()
           
 java.util.Collection getTreeCacheListeners()
          Returns a Map contains the listeners to this tree cache
 boolean getUseInterceptorMbeans()
          Gets whether the cache should register its interceptor mbeans.
 boolean getUseMarshalling()
          Gets whether a TreeCacheMarshaller instance should be used to manage different classloaders to use for unmarshalling replicated objects.
 boolean getUseReplQueue()
           
 java.lang.String getVersion()
           
 boolean hasChild(Fqn fqn)
           
 void inactivateRegion(java.lang.String subtreeFqn)
          Causes the cache to stop accepting replication events for the subtree rooted at subtreeFqn and evict all nodes in that subtree.
protected  java.lang.Object invokeMethod(org.jgroups.blocks.MethodCall m)
          Invokes a method against this object.
 boolean isCoordinator()
           
static boolean isCrudMethod(java.lang.reflect.Method m)
           
 boolean isInactiveOnStartup()
          Gets whether the entire tree is inactive upon startup, only responding to replication messages after activateRegion(String) is called to activate one or more parts of the tree.
 boolean isNodeLockingOptimistic()
          returns whether node locking is optimistic.
 void load(java.lang.String fqn)
          Loads the indicated Fqn, plus all parents recursively from the CacheLoader.
protected  java.lang.Class loadClass(java.lang.String classname)
          Loads the specified class using this class's classloader, or, if it is null (i.e.
protected  void notifyAllNodesCreated(DataNode curr)
          Generates NodeAdded notifications for all nodes of the tree.
protected  void notifyCacheStarted()
           
protected  void notifyCacheStopped()
           
 void notifyCallForInactiveSubtree(java.lang.String fqn)
          Method provided to JGroups by TreeCacheMarshaller.objectFromByteBuffer(byte[]) when it receives a replication event for an Fqn that has been marked as inactive.
 void notifyNodeActivate(Fqn fqn, boolean pre)
           
 void notifyNodeCreated(Fqn fqn)
           
protected  void notifyNodeEvict(Fqn fqn, boolean pre)
           
protected  void notifyNodeEvicted(Fqn fqn)
           
 void notifyNodeLoaded(Fqn fqn)
           
protected  void notifyNodeModified(Fqn fqn)
           
protected  void notifyNodeModify(Fqn fqn, boolean pre)
           
 void notifyNodePassivate(Fqn fqn, boolean pre)
           
protected  void notifyNodeRemove(Fqn fqn, boolean pre)
           
protected  void notifyNodeRemoved(Fqn fqn)
           
protected  void notifyNodeVisited(Fqn fqn)
           
protected  void notifyViewChange(org.jgroups.View v)
           
 void optimisticPrepare(GlobalTransaction gtx, java.util.List modifications, java.util.Map data, org.jgroups.Address address, boolean onePhaseCommit)
           
 DataNode peek(Fqn fqn)
           
 java.lang.Object peek(Fqn fqn, java.lang.Object key)
          Like get() method but without triggering a node visit event.
 void prepare(GlobalTransaction global_tx, java.util.List modifications, org.jgroups.Address coord, boolean onePhaseCommit)
           
 java.lang.String print(Fqn fqn)
          Prints a representation of the node defined by fqn.
 java.lang.String print(java.lang.String fqn)
          Prints a representation of the node defined by fqn.
 java.lang.String printDetails()
           
 java.lang.String printLockInfo()
           
 void put(Fqn fqn, java.util.Map data)
          Adds a new node to the tree and sets its data.
 void put(Fqn fqn, java.util.Map data, Option option)
          The same as calling put(Fqn, Map) except that you can pass in options for this specific method invocation.
 java.lang.Object put(Fqn fqn, java.lang.Object key, java.lang.Object value)
          Adds a key and value to a given node.
 void put(Fqn fqn, java.lang.Object key, java.lang.Object value, Option option)
          The same as calling put(Fqn, Object, Object) except that you can pass in options for this specific method invocation.
 void put(java.lang.String fqn, java.util.Map data)
          Adds a new node to the tree and sets its data.
 java.lang.Object put(java.lang.String fqn, java.lang.Object key, java.lang.Object value)
          Adds a key and value to a given node.
 java.lang.Object putFailFast(Fqn fqn, java.lang.Object key, java.lang.Object value, long timeout)
          Deprecated. This is a kludge created specifically form the Hibernate 3.0 release. This method should not be used by any application. The methodV will likely be removed in a future release
 java.lang.Object putFailFast(java.lang.String fqn, java.lang.Object key, java.lang.Object value, long timeout)
          Deprecated.  
 void registerClassLoader(java.lang.String fqn, java.lang.ClassLoader cl)
          If useMarshalling is true, we will use TreeCacheMarshaller for marshalling.
 void releaseAllLocks(Fqn fqn)
          Force-releases all locks in this node and the entire subtree
 void releaseAllLocks(java.lang.String fqn)
          Force-releases all locks in this node and the entire subtree
protected  void releaseStateTransferLocks(DataNode root, java.lang.Object lockOwner, boolean childrenLocked)
           
 void remove(Fqn fqn)
          Removes the node from the tree.
 java.lang.Object remove(Fqn fqn, java.lang.Object key)
          Removes key from the node's hashmap
 java.lang.Object remove(Fqn fqn, java.lang.Object key, Option option)
          The same as calling remove(Fqn, Object) except that you can pass in options for this specific method invocation.
 void remove(Fqn fqn, Option option)
          The same as calling remove(Fqn) except that you can pass in options for this specific method invocation.
 void remove(java.lang.String fqn)
          Removes the node from the tree.
 java.lang.Object remove(java.lang.String fqn, java.lang.Object key)
          Removes key from the node's hashmap
 void removeData(Fqn fqn)
           
 void removeData(java.lang.String fqn)
           
 void removeTreeCacheListener(TreeCacheListener listener)
           
 void rollback(GlobalTransaction tx)
           
 void setCacheLoader(CacheLoader loader)
          Deprecated.  
 void setCacheLoaderAsynchronous(boolean b)
          Deprecated.  
 void setCacheLoaderClass(java.lang.String cache_loader_class)
          Deprecated.  
 void setCacheLoaderConfig(java.util.Properties cache_loader_config)
          Deprecated.  
 void setCacheLoaderConfiguration(org.w3c.dom.Element cache_loader_config)
           
 void setCacheLoaderFetchPersistentState(boolean flag)
          Deprecated.  
 void setCacheLoaderFetchTransientState(boolean flag)
          Deprecated.  
 void setCacheLoaderManager(CacheLoaderManager cacheLoaderManager)
           
 void setCacheLoaderPassivation(boolean passivate)
          Deprecated.  
 void setCacheLoaderPreload(java.lang.String list)
          Deprecated.  
 void setCacheLoaderShared(boolean shared)
          Deprecated.  
 void setCacheMode(int mode)
          Sets the default cache mode.
 void setCacheMode(java.lang.String mode)
          Sets the default caching mode)
 void setClusterConfig(org.w3c.dom.Element config)
          Convert a list of elements to the JG property string
 void setClusterName(java.lang.String name)
          Set the name of the replication group
 void setClusterProperties(java.lang.String cluster_props)
          Set the cluster properties.
 void setDeadlockDetection(boolean dt)
          Deprecated.  
 void setEvictionListener(TreeCacheListener listener)
           
 void setEvictionPolicyClass(java.lang.String eviction_policy_class)
          Sets the classname of the eviction policy
 void setEvictionPolicyConfig(org.w3c.dom.Element config)
          Setup eviction policy configuration
 void setEvictionPolicyProvider(EvictionPolicy policy)
          Deprecated. DO NOT USE THIS METHOD. IT IS PROVIDED FOR FULL JBCACHE 1.2 API BACKWARDS COMPATIBILITY
 void setFetchInMemoryState(boolean flag)
          Sets whether or not any initial or subsequent partial state transfer should include in-memory state.
 void setFetchStateOnStartup(boolean flag)
          Sets whether or not on startup to acquire the initial state from existing members.
 void setInactiveOnStartup(boolean inactiveOnStartup)
          Sets whether the entire tree is inactive upon startup, only responding to replication messages after activateRegion(String) is called to activage one or more parts of the tree.
 void setInitialStateRetrievalTimeout(long timeout)
          Set the initial state transfer timeout (see getInitialStateRetrievalTimeout())
 void setInterceptorChain(Interceptor i)
          Used for unit tests only - to force interceptor chains.
 void setInvocationContext(InvocationContext invocationContext)
          Sets the invocation context
 void setIsolationLevel(IsolationLevel level)
           
 void setIsolationLevel(java.lang.String level)
          Set the transaction isolation level.
 void setLockAcquisitionTimeout(long timeout)
          Set the max time for lock acquisition.
protected  void setNodeLockingOptimistic(boolean b)
          Sets whether to use optimistic locking on the nodes.
 void setNodeLockingScheme(java.lang.String s)
           
 void setReplication_handler(Replicatable replication_handler)
           
 void setReplicationVersion(java.lang.String versionString)
          Sets the format version of the data transferred during an initial state transfer or a call to TreeCacheMBean.activateRegion(String).
 void setReplQueueInterval(long interval)
           
 void setReplQueueMaxElements(int max_elements)
           
 void setStateBytes(byte[] state)
           
 void setStateTransferVersion(short version)
          Sets the format version of the data transferred during an initial state transfer or a call to TreeCacheMBean.activateRegion(String).
 void setSyncCommitPhase(boolean sync_commit_phase)
           
 void setSyncReplTimeout(long timeout)
          Sets the default maximum wait time for synchronous replication to receive all results
 void setSyncRollbackPhase(boolean sync_rollback_phase)
           
 void setTransactionManagerLookup(TransactionManagerLookup l)
          Sets the TransactionManagerLookup object
 void setTransactionManagerLookupClass(java.lang.String cl)
          Sets the class of the TransactionManagerLookup impl.
 void setUseInterceptorMbeans(boolean useMbeans)
          Specifies whether the cache should register its interceptor mbeans.
 void setUseMarshalling(boolean isTrue)
          Sets whether a TreeCacheMarshaller instance should be created to manage different classloaders to use for unmarshalling replicated objects.
 void setUseReplQueue(boolean flag)
           
 void startService()
          Lifecyle method.
 void stopService()
          Lifecycle method.
protected  int string2Mode(java.lang.String mode)
           
 void suspect(org.jgroups.Address suspected_mbr)
          Called when a member is suspected
 java.lang.String toString()
           
 java.lang.String toString(boolean details)
           
 void unregisterClassLoader(java.lang.String fqn)
          If useMarshalling is true, we will use unregister this region.
 void viewAccepted(org.jgroups.View new_view)
           
 
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

DEFAULT_REPLICATION_VERSION

public static final short DEFAULT_REPLICATION_VERSION

root

protected DataNode root

hasListeners

protected boolean hasListeners

channel

protected org.jgroups.JChannel channel

coordinator

protected boolean coordinator
Am I the coordinator ?


log

protected static final org.apache.commons.logging.Log log

cluster_name

protected java.lang.String cluster_name

cluster_props

protected java.lang.String cluster_props

members

protected final java.util.Vector members

disp

protected org.jgroups.blocks.RpcDispatcher disp

ml

protected org.jgroups.MessageListener ml

use_repl_queue

protected boolean use_repl_queue

repl_queue_max_elements

protected int repl_queue_max_elements

repl_queue_interval

protected long repl_queue_interval

region_msg_queues

protected java.util.Map region_msg_queues

use_interceptor_mbeans

protected boolean use_interceptor_mbeans

fetchInMemoryState

protected boolean fetchInMemoryState

lock_acquisition_timeout

protected long lock_acquisition_timeout

state_fetch_timeout

protected long state_fetch_timeout

sync_repl_timeout

protected long sync_repl_timeout

eviction_policy_class

protected java.lang.String eviction_policy_class

cache_mode

protected int cache_mode

inactiveOnStartup

protected boolean inactiveOnStartup

isStandalone

protected boolean isStandalone

putDataMethodLocal

public static java.lang.reflect.Method putDataMethodLocal

putDataEraseMethodLocal

public static java.lang.reflect.Method putDataEraseMethodLocal

putKeyValMethodLocal

public static java.lang.reflect.Method putKeyValMethodLocal

putFailFastKeyValueMethodLocal

public static java.lang.reflect.Method putFailFastKeyValueMethodLocal

removeNodeMethodLocal

public static java.lang.reflect.Method removeNodeMethodLocal

removeKeyMethodLocal

public static java.lang.reflect.Method removeKeyMethodLocal

removeDataMethodLocal

public static java.lang.reflect.Method removeDataMethodLocal

evictNodeMethodLocal

public static java.lang.reflect.Method evictNodeMethodLocal

evictVersionedNodeMethodLocal

public static java.lang.reflect.Method evictVersionedNodeMethodLocal

prepareMethod

public static java.lang.reflect.Method prepareMethod

commitMethod

public static java.lang.reflect.Method commitMethod

rollbackMethod

public static java.lang.reflect.Method rollbackMethod

replicateMethod

public static java.lang.reflect.Method replicateMethod

replicateAllMethod

public static java.lang.reflect.Method replicateAllMethod

addChildMethodLocal

public static java.lang.reflect.Method addChildMethodLocal

getKeyValueMethodLocal

public static java.lang.reflect.Method getKeyValueMethodLocal

getNodeMethodLocal

public static java.lang.reflect.Method getNodeMethodLocal

getKeysMethodLocal

public static java.lang.reflect.Method getKeysMethodLocal

getChildrenNamesMethodLocal

public static java.lang.reflect.Method getChildrenNamesMethodLocal

getDataMapMethodLocal

public static java.lang.reflect.Method getDataMapMethodLocal

existsMethod

public static java.lang.reflect.Method existsMethod

releaseAllLocksMethodLocal

public static java.lang.reflect.Method releaseAllLocksMethodLocal

printMethodLocal

public static java.lang.reflect.Method printMethodLocal

lockMethodLocal

public static java.lang.reflect.Method lockMethodLocal

optimisticPrepareMethod

public static java.lang.reflect.Method optimisticPrepareMethod

getPartialStateMethod

public static java.lang.reflect.Method getPartialStateMethod

enqueueMethodCallMethod

public static java.lang.reflect.Method enqueueMethodCallMethod

notifyCallOnInactiveMethod

public static java.lang.reflect.Method notifyCallOnInactiveMethod

clusteredGetMethod

public static java.lang.reflect.Method clusteredGetMethod

isStateSet

protected boolean isStateSet

setStateException

protected java.lang.Exception setStateException

isolationLevel

protected IsolationLevel isolationLevel

evictConfig_

protected org.w3c.dom.Element evictConfig_
Eviction policy configuration in xml Element


useMarshalling_

protected boolean useMarshalling_
Check to see if we need to use marshalling


marshaller_

protected TreeCacheMarshaller marshaller_
Marshaller if register to handle marshalling


regionManager_

protected RegionManager regionManager_
RegionManager used by marshaller and ExtendedCacheLoader


evictionRegionManager_

protected RegionManager evictionRegionManager_
RegionManager used by cache eviction


interceptor_chain

protected Interceptor interceptor_chain
invokeMethod(MethodCall) will dispatch to this chain of interceptors. In the future, this will be replaced with JBossAop. This is a first step towards refactoring JBossCache.


tm_lookup

protected TransactionManagerLookup tm_lookup
Method to acquire a TransactionManager. By default we use JBossTransactionManagerLookup. Has to be set before calling ServiceMBeanSupport.start()


tm_lookup_class

protected java.lang.String tm_lookup_class
Class of the implementation of TransactionManagerLookup


tm

protected javax.transaction.TransactionManager tm
Used to get the Transaction associated with the current thread


cacheLoaderConfig

protected org.w3c.dom.Element cacheLoaderConfig
The XML Element from which to configure the CacheLoader


cacheLoaderManager

protected CacheLoaderManager cacheLoaderManager

cloaderConfig

protected CacheLoaderConfig cloaderConfig
for legacy use *


sync_commit_phase

protected boolean sync_commit_phase
synchronous or asynchrous commit phase ?


sync_rollback_phase

protected boolean sync_rollback_phase
synchronous or asynchrous rollback phase ?


eviction_policy_provider

protected EvictionPolicy eviction_policy_provider
Deprecated. DO NOT USE THIS. IT IS HERE FOR EJB3 COMPILATION COMPATIBILITY WITH JBOSSCACHE1.3

replication_handler

protected Replicatable replication_handler

repl_queue

protected ReplicationQueue repl_queue
Queue used to replicate updates when mode is repl-async


SEPARATOR

public static final java.lang.String SEPARATOR
See Also:
Constant Field Values

LOCAL

public static final int LOCAL
Entries in the cache are by default local; ie. not replicated

See Also:
Constant Field Values

REPL_ASYNC

public static final int REPL_ASYNC
Entries in the cache are by default replicated (asynchronously)

See Also:
Constant Field Values

REPL_SYNC

public static final int REPL_SYNC
Entries in the cache are by default replicated (synchronously)

See Also:
Constant Field Values

INVALIDATION_ASYNC

public static final int INVALIDATION_ASYNC
Cache sends evict() calls to remote caches when a node is changed. evict() calls are asynchronous. *

See Also:
Constant Field Values

INVALIDATION_SYNC

public static final int INVALIDATION_SYNC
Cache sends evict() calls to remote caches when a node is changed. evict() calls are synchronous. *

See Also:
Constant Field Values

UNINITIALIZED

public static final java.lang.String UNINITIALIZED
See Also:
Constant Field Values

nodeLockingOptimistic

protected boolean nodeLockingOptimistic
Determines whether to use optimistic locking or not. Disabled by default.


useCreateService

protected boolean useCreateService

activationChangeNodes

protected final java.util.Set activationChangeNodes
Set of Fqns of nodes that are currently being processed by activateReqion or inactivateRegion. Requests for these fqns will be ignored by _getState().

Constructor Detail

TreeCache

public TreeCache(java.lang.String cluster_name,
                 java.lang.String props,
                 long state_fetch_timeout)
          throws java.lang.Exception
Creates a channel with the given properties. Connects to the channel, then creates a PullPushAdapter and starts it

Throws:
java.lang.Exception

TreeCache

public TreeCache()
          throws java.lang.Exception
Throws:
java.lang.Exception

TreeCache

public TreeCache(org.jgroups.JChannel channel)
          throws java.lang.Exception
Expects an already connected channel. Creates a PullPushAdapter and starts it

Throws:
java.lang.Exception
Method Detail

getMessageListener

public org.jgroups.MessageListener getMessageListener()

isCrudMethod

public static boolean isCrudMethod(java.lang.reflect.Method m)

getVersion

public java.lang.String getVersion()
Specified by:
getVersion in interface TreeCacheMBean

getRoot

public DataNode getRoot()
Used by interceptors. Don't use as client, will go away: interceptors will use TreeCacheImpl and clients will only be able to use TreeCache (which will become an interface)

Returns:
the root node

getLocalAddress

public java.lang.Object getLocalAddress()
Specified by:
getLocalAddress in interface TreeCacheMBean
Returns:
local address

getMembers

public java.util.Vector getMembers()
Specified by:
getMembers in interface TreeCacheMBean
Returns:
vector of members

isCoordinator

public boolean isCoordinator()
Specified by:
isCoordinator in interface TreeCacheMBean
Returns:
whether the cache is the grp coord

getClusterName

public java.lang.String getClusterName()
Get the name of the replication group

Specified by:
getClusterName in interface TreeCacheMBean

setClusterName

public void setClusterName(java.lang.String name)
Set the name of the replication group

Specified by:
setClusterName in interface TreeCacheMBean

getClusterProperties

public java.lang.String getClusterProperties()
Get the cluster properties (e.g. the protocol stack specification in case of JGroups)

Specified by:
getClusterProperties in interface TreeCacheMBean

setClusterProperties

public void setClusterProperties(java.lang.String cluster_props)
Set the cluster properties. If the cache is to use the new properties, it has to be redeployed

Specified by:
setClusterProperties in interface TreeCacheMBean
Parameters:
cluster_props - The properties for the cluster (JGroups)

getTransactionTable

public TransactionTable getTransactionTable()

getLockTable

public java.util.Map getLockTable()

dumpTransactionTable

public java.lang.String dumpTransactionTable()
Dumps the contents of the TransactionTable

Specified by:
dumpTransactionTable in interface TreeCacheMBean

getDeadlockDetection

public boolean getDeadlockDetection()
Deprecated. 

Specified by:
getDeadlockDetection in interface TreeCacheMBean
Returns:
Whether deadlock detection is enabled

setDeadlockDetection

public void setDeadlockDetection(boolean dt)
Deprecated. 

Specified by:
setDeadlockDetection in interface TreeCacheMBean
Parameters:
dt -

getInterceptorChain

public java.lang.String getInterceptorChain()
Specified by:
getInterceptorChain in interface TreeCacheMBean
Returns:
the interceptor chain as a str

setInterceptorChain

public void setInterceptorChain(Interceptor i)
Used for unit tests only - to force interceptor chains.

Parameters:
i -

getInterceptors

public java.util.List getInterceptors()
Specified by:
getInterceptors in interface TreeCacheMBean
Returns:
List

getCacheLoaderConfiguration

public org.w3c.dom.Element getCacheLoaderConfiguration()
Specified by:
getCacheLoaderConfiguration in interface TreeCacheMBean

setReplication_handler

public void setReplication_handler(Replicatable replication_handler)

setCacheLoaderConfiguration

public void setCacheLoaderConfiguration(org.w3c.dom.Element cache_loader_config)
Specified by:
setCacheLoaderConfiguration in interface TreeCacheMBean
Parameters:
cache_loader_config -

getCacheLoader

public CacheLoader getCacheLoader()
Specified by:
getCacheLoader in interface TreeCacheMBean

isInactiveOnStartup

public boolean isInactiveOnStartup()
Gets whether the entire tree is inactive upon startup, only responding to replication messages after activateRegion(String) is called to activate one or more parts of the tree.

This property is only relevant if getUseMarshalling() is true.

Specified by:
isInactiveOnStartup in interface TreeCacheMBean

setInactiveOnStartup

public void setInactiveOnStartup(boolean inactiveOnStartup)
Sets whether the entire tree is inactive upon startup, only responding to replication messages after activateRegion(String) is called to activage one or more parts of the tree.

This property is only relevant if getUseMarshalling() is true.

Specified by:
setInactiveOnStartup in interface TreeCacheMBean

getSyncCommitPhase

public boolean getSyncCommitPhase()
Specified by:
getSyncCommitPhase in interface TreeCacheMBean

setSyncCommitPhase

public void setSyncCommitPhase(boolean sync_commit_phase)
Specified by:
setSyncCommitPhase in interface TreeCacheMBean
Parameters:
sync_commit_phase -

getSyncRollbackPhase

public boolean getSyncRollbackPhase()
Specified by:
getSyncRollbackPhase in interface TreeCacheMBean

setSyncRollbackPhase

public void setSyncRollbackPhase(boolean sync_rollback_phase)
Specified by:
setSyncRollbackPhase in interface TreeCacheMBean
Parameters:
sync_rollback_phase -

setEvictionPolicyConfig

public void setEvictionPolicyConfig(org.w3c.dom.Element config)
Setup eviction policy configuration

Specified by:
setEvictionPolicyConfig in interface TreeCacheMBean

getEvictionPolicyConfig

public org.w3c.dom.Element getEvictionPolicyConfig()

setClusterConfig

public void setClusterConfig(org.w3c.dom.Element config)
Convert a list of elements to the JG property string

Specified by:
setClusterConfig in interface TreeCacheMBean

getInitialStateRetrievalTimeout

public long getInitialStateRetrievalTimeout()
Get the max time to wait until the initial state is retrieved. This is used in a replicating cache: when a new cache joins the cluster, it needs to acquire the (replicated) state of the other members to initialize itself. If no state has been received within timeout milliseconds, the map will be empty.

Specified by:
getInitialStateRetrievalTimeout in interface TreeCacheMBean
Returns:
long Number of milliseconds to wait for the state. 0 means to wait forever.

setInitialStateRetrievalTimeout

public void setInitialStateRetrievalTimeout(long timeout)
Set the initial state transfer timeout (see getInitialStateRetrievalTimeout())

Specified by:
setInitialStateRetrievalTimeout in interface TreeCacheMBean

getCacheMode

public java.lang.String getCacheMode()
Returns the current caching mode. Valid values are

getCacheModeInternal

public int getCacheModeInternal()

setNodeLockingScheme

public void setNodeLockingScheme(java.lang.String s)
Specified by:
setNodeLockingScheme in interface TreeCacheMBean

getNodeLockingScheme

public java.lang.String getNodeLockingScheme()
Specified by:
getNodeLockingScheme in interface TreeCacheMBean

setNodeLockingOptimistic

protected void setNodeLockingOptimistic(boolean b)
Sets whether to use optimistic locking on the nodes.


isNodeLockingOptimistic

public boolean isNodeLockingOptimistic()
returns whether node locking is optimistic.


setCacheMode

public void setCacheMode(java.lang.String mode)
                  throws java.lang.Exception
Sets the default caching mode)

Specified by:
setCacheMode in interface TreeCacheMBean
Throws:
java.lang.Exception

setCacheMode

public void setCacheMode(int mode)
Sets the default cache mode. Valid arguments are
  1. TreeCache.LOCAL
  2. TreeCache.REPL_ASYNC
  3. TreeCache.REPL_SYNC

Parameters:
mode -

getSyncReplTimeout

public long getSyncReplTimeout()
Returns the default max timeout after which synchronous replication calls return.

Specified by:
getSyncReplTimeout in interface TreeCacheMBean
Returns:
long Number of milliseconds after which a sync repl call must return. 0 means to wait forever

setSyncReplTimeout

public void setSyncReplTimeout(long timeout)
Sets the default maximum wait time for synchronous replication to receive all results

Specified by:
setSyncReplTimeout in interface TreeCacheMBean

getUseReplQueue

public boolean getUseReplQueue()
Specified by:
getUseReplQueue in interface TreeCacheMBean

setUseReplQueue

public void setUseReplQueue(boolean flag)
Specified by:
setUseReplQueue in interface TreeCacheMBean
Parameters:
flag -

getReplQueueInterval

public long getReplQueueInterval()
Specified by:
getReplQueueInterval in interface TreeCacheMBean

setReplQueueInterval

public void setReplQueueInterval(long interval)
Specified by:
setReplQueueInterval in interface TreeCacheMBean
Parameters:
interval -

getReplQueueMaxElements

public int getReplQueueMaxElements()
Specified by:
getReplQueueMaxElements in interface TreeCacheMBean

setReplQueueMaxElements

public void setReplQueueMaxElements(int max_elements)
Specified by:
setReplQueueMaxElements in interface TreeCacheMBean
Parameters:
max_elements -

getReplQueue

public ReplicationQueue getReplQueue()

getIsolationLevel

public java.lang.String getIsolationLevel()
Returns the transaction isolation level.

Specified by:
getIsolationLevel in interface TreeCacheMBean

setIsolationLevel

public void setIsolationLevel(java.lang.String level)
Set the transaction isolation level. This determines the locking strategy to be used

Specified by:
setIsolationLevel in interface TreeCacheMBean

setIsolationLevel

public void setIsolationLevel(IsolationLevel level)
Parameters:
level -

getIsolationLevelClass

public IsolationLevel getIsolationLevelClass()

getFetchStateOnStartup

public boolean getFetchStateOnStartup()
Description copied from interface: TreeCacheMBean
Returns whether or not on startup the initial state will be acquired from existing members.

Specified by:
getFetchStateOnStartup in interface TreeCacheMBean
Returns:
true if TreeCacheMBean.isInactiveOnStartup() is false and either TreeCacheMBean.getFetchInMemoryState() is true or a cache loader's FetchPersistentState property is true.

setFetchStateOnStartup

public void setFetchStateOnStartup(boolean flag)
Description copied from interface: TreeCacheMBean
Sets whether or not on startup to acquire the initial state from existing members.

Specified by:
setFetchStateOnStartup in interface TreeCacheMBean

setFetchInMemoryState

public void setFetchInMemoryState(boolean flag)
Description copied from interface: TreeCacheMBean
Sets whether or not any initial or subsequent partial state transfer should include in-memory state.

Specified by:
setFetchInMemoryState in interface TreeCacheMBean

getFetchInMemoryState

public boolean getFetchInMemoryState()
Description copied from interface: TreeCacheMBean
Returns whether or not any initial state transfer or subsequent partial state transfer following an activateRegion call should include in-memory state. Allows for warm/hot caches (true/false). The characteristics of a state transfer can be further defined by a cache loader's FetchPersistentState property.

Specified by:
getFetchInMemoryState in interface TreeCacheMBean

getLockAcquisitionTimeout

public long getLockAcquisitionTimeout()
Default max time to wait for a lock. If the lock cannot be acquired within this time, a LockingException will be thrown.

Specified by:
getLockAcquisitionTimeout in interface TreeCacheMBean
Returns:
long Max number of milliseconds to wait for a lock to be acquired

setLockAcquisitionTimeout

public void setLockAcquisitionTimeout(long timeout)
Set the max time for lock acquisition. A value of 0 means to wait forever (not recomended). Note that lock acquisition timeouts may be removed in the future when we have deadlock detection.

Specified by:
setLockAcquisitionTimeout in interface TreeCacheMBean
Parameters:
timeout -

getEvictionPolicyClass

public java.lang.String getEvictionPolicyClass()
Returns the name of the cache eviction policy (must be an implementation of EvictionPolicy)

Specified by:
getEvictionPolicyClass in interface TreeCacheMBean
Returns:
Fully qualified name of a class implementing the EvictionPolicy interface

setEvictionPolicyClass

public void setEvictionPolicyClass(java.lang.String eviction_policy_class)
Sets the classname of the eviction policy

Specified by:
setEvictionPolicyClass in interface TreeCacheMBean

getEvictionThreadWakeupIntervalSeconds

public int getEvictionThreadWakeupIntervalSeconds()
Obtain eviction thread (if any) wake up interval in seconds

Specified by:
getEvictionThreadWakeupIntervalSeconds in interface TreeCacheMBean

setTransactionManagerLookup

public void setTransactionManagerLookup(TransactionManagerLookup l)
Sets the TransactionManagerLookup object

Specified by:
setTransactionManagerLookup in interface TreeCacheMBean
Parameters:
l -

getTransactionManagerLookupClass

public java.lang.String getTransactionManagerLookupClass()
Specified by:
getTransactionManagerLookupClass in interface TreeCacheMBean

setTransactionManagerLookupClass

public void setTransactionManagerLookupClass(java.lang.String cl)
                                      throws java.lang.Exception
Sets the class of the TransactionManagerLookup impl. This will attempt to create an instance, and will throw an exception if this fails.

Specified by:
setTransactionManagerLookupClass in interface TreeCacheMBean
Parameters:
cl -
Throws:
java.lang.Exception

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Specified by:
getTransactionManager in interface TreeCacheMBean

getUseInterceptorMbeans

public boolean getUseInterceptorMbeans()
Description copied from interface: TreeCacheMBean
Gets whether the cache should register its interceptor mbeans. These mbeans are used to capture and publish interceptor statistics.

Specified by:
getUseInterceptorMbeans in interface TreeCacheMBean
Returns:
true if mbeans should be registered for each interceptor

setUseInterceptorMbeans

public void setUseInterceptorMbeans(boolean useMbeans)
Description copied from interface: TreeCacheMBean
Specifies whether the cache should register its interceptor mbeans. These mbeans are used to capture and publish interceptor statistics. Once registered, statistics can be turned off for individual interceptors.

Specified by:
setUseInterceptorMbeans in interface TreeCacheMBean
Parameters:
useMbeans - true is mbeans should be registered for each cache interceptor

getInstance

public TreeCache getInstance()
Description copied from interface: TreeCacheMBean
Returns a reference to the TreeCache object itself. Note that acquiring such a reference in a JMX managed environment causes tight coupling between the client using the cache and the cache service, thus negating one of the key benefits of using JMX.

Specified by:
getInstance in interface TreeCacheMBean

fetchState

public void fetchState(long timeout)
                throws org.jgroups.ChannelClosedException,
                       org.jgroups.ChannelNotConnectedException
Fetch the group state from the current coordinator. If successful, this will trigger setState().

Specified by:
fetchState in interface TreeCacheMBean
Throws:
org.jgroups.ChannelClosedException
org.jgroups.ChannelNotConnectedException

setEvictionListener

public void setEvictionListener(TreeCacheListener listener)

addTreeCacheListener

public void addTreeCacheListener(TreeCacheListener listener)
Specified by:
addTreeCacheListener in interface TreeCacheMBean
Parameters:
listener -

removeTreeCacheListener

public void removeTreeCacheListener(TreeCacheListener listener)
Specified by:
removeTreeCacheListener in interface TreeCacheMBean
Parameters:
listener -

getTreeCacheListeners

public java.util.Collection getTreeCacheListeners()
Returns a Map contains the listeners to this tree cache

Returns:
a map contains the listeners to this tree cache

createService

public void createService()
                   throws java.lang.Exception
Lifecycle method. This is like initialize. Same thing as calling create

Specified by:
createService in interface TreeCacheMBean
Overrides:
createService in class org.jboss.system.ServiceMBeanSupport
Throws:
java.lang.Exception

_createService

protected void _createService()
                       throws java.lang.Exception
Throws:
java.lang.Exception

startService

public void startService()
                  throws java.lang.Exception
Lifecyle method. This is the same thing as calling start

Specified by:
startService in interface TreeCacheMBean
Overrides:
startService in class org.jboss.system.ServiceMBeanSupport
Throws:
java.lang.Exception

destroyService

public void destroyService()
Lifecycle mthod.

Specified by:
destroyService in interface TreeCacheMBean
Overrides:
destroyService in class org.jboss.system.ServiceMBeanSupport

stopService

public void stopService()
Lifecycle method. Same thing as calling stop.

Specified by:
stopService in interface TreeCacheMBean
Overrides:
stopService in class org.jboss.system.ServiceMBeanSupport

setEvictionPolicyProvider

public void setEvictionPolicyProvider(EvictionPolicy policy)
Deprecated. DO NOT USE THIS METHOD. IT IS PROVIDED FOR FULL JBCACHE 1.2 API BACKWARDS COMPATIBILITY


setUseMarshalling

public void setUseMarshalling(boolean isTrue)
Description copied from interface: TreeCacheMBean
Sets whether a TreeCacheMarshaller instance should be created to manage different classloaders to use for unmarshalling replicated objects.

This property must be set to true before any call to TreeCacheMBean.registerClassLoader(String, ClassLoader) or TreeCacheMBean.activateRegion(String)

Specified by:
setUseMarshalling in interface TreeCacheMBean

getUseMarshalling

public boolean getUseMarshalling()
Description copied from interface: TreeCacheMBean
Gets whether a TreeCacheMarshaller instance should be used to manage different classloaders to use for unmarshalling replicated objects.

Specified by:
getUseMarshalling in interface TreeCacheMBean

load

public void load(java.lang.String fqn)
          throws java.lang.Exception
Loads the indicated Fqn, plus all parents recursively from the CacheLoader. If no CacheLoader is present, this is a no-op

Specified by:
load in interface TreeCacheMBean
Parameters:
fqn -
Throws:
java.lang.Exception

determineCoordinator

protected boolean determineCoordinator()

getCoordinator

public org.jgroups.Address getCoordinator()

getStateBytes

public byte[] getStateBytes()

setStateBytes

public void setStateBytes(byte[] state)

registerClassLoader

public void registerClassLoader(java.lang.String fqn,
                                java.lang.ClassLoader cl)
                         throws RegionNameConflictException
If useMarshalling is true, we will use TreeCacheMarshaller for marshalling. User will register the specific class loader through this api.

Specified by:
registerClassLoader in interface TreeCacheMBean
Parameters:
fqn - The fqn region. Children of this fqn will use this classloader for (un)marshalling.
cl - The class loader to use
Throws:
RegionNameConflictException - If there is a conflict in fqn specification.

unregisterClassLoader

public void unregisterClassLoader(java.lang.String fqn)
                           throws RegionNotFoundException
If useMarshalling is true, we will use unregister this region.

Specified by:
unregisterClassLoader in interface TreeCacheMBean
Parameters:
fqn - The fqn region.
Throws:
RegionNotFoundException - If there is a conflict in fqn specification.

activateRegion

public void activateRegion(java.lang.String subtreeFqn)
                    throws RegionNotEmptyException,
                           RegionNameConflictException,
                           CacheException
Causes the cache to transfer state for the subtree rooted at subtreeFqn and to begin accepting replication messages for that subtree.

NOTE: This method will cause the creation of a node in the local tree at subtreeFqn whether or not that node exists anywhere else in the cluster. If the node does not exist elsewhere, the local node will be empty. The creation of this node will not be replicated.

Specified by:
activateRegion in interface TreeCacheMBean
Parameters:
subtreeFqn - Fqn string indicating the uppermost node in the portion of the tree that should be activated.
Throws:
RegionNotEmptyException - if the node subtreeFqn exists and has either data or children
java.lang.IllegalStateException - if useMarshalling is false
RegionNameConflictException
CacheException

createSubtreeRootNode

protected DataNode createSubtreeRootNode(Fqn subtree)
                                  throws CacheException
Throws:
CacheException

inactivateRegion

public void inactivateRegion(java.lang.String subtreeFqn)
                      throws RegionNameConflictException,
                             CacheException
Causes the cache to stop accepting replication events for the subtree rooted at subtreeFqn and evict all nodes in that subtree.

Specified by:
inactivateRegion in interface TreeCacheMBean
Parameters:
subtreeFqn - Fqn string indicating the uppermost node in the portion of the tree that should be activated.
Throws:
RegionNameConflictException - if subtreeFqn indicates a node that is part of another subtree that is being specially managed (either by activate/inactiveRegion() or by registerClassLoader())
CacheException - if there is a problem evicting nodes
java.lang.IllegalStateException - if useMarshalling is false

_evictSubtree

protected void _evictSubtree(Fqn subtree)
                      throws CacheException
Evicts the node at subtree along with all descendant nodes.

Parameters:
subtree - Fqn indicating the uppermost node in the portion of the tree that should be evicted.
Throws:
CacheException

_enqueueMethodCall

public void _enqueueMethodCall(java.lang.String subtree,
                               org.jgroups.blocks.MethodCall call)
                        throws java.lang.Throwable
Throws:
java.lang.Throwable

_getState

public byte[] _getState(Fqn fqn,
                        long timeout,
                        boolean force,
                        boolean suppressErrors)
                 throws java.lang.Throwable
Returns the state for the portion of the tree named by fqn.

State returned is a serialized byte[][], element 0 is the transient state (or null), and element 1 is the persistent state (or null).

Parameters:
fqn - Fqn indicating the uppermost node in the portion of the tree whose state should be returned.
timeout - max number of ms this method should wait to acquire a read lock on the nodes being transferred
force - if a read lock cannot be acquired after timeout ms, should the lock acquisition be forced, and any existing transactions holding locks on the nodes be rolled back? NOTE: In release 1.2.4, this parameter has no effect.
suppressErrors - should any Throwable thrown be suppressed?
Returns:
a serialized byte[][], element 0 is the transient state (or null), and element 1 is the persistent state (or null).
Throws:
java.lang.UnsupportedOperationException - if persistent state transfer is enabled, the requested Fqn is not the root node, and the cache loader does not implement ExtendedCacheLoader.
java.lang.Throwable

_getAssociatedState

protected byte[] _getAssociatedState(Fqn fqn,
                                     long timeout,
                                     boolean force)
                              throws java.lang.Exception
Returns any state stored in the cache that needs to be propagated along with the normal transient state in a subtree when _getState(Fqn, long, boolean, boolean) is called for an Fqn. Typically this would be state stored outside of the subtree that is somehow associated with the subtree.

This method is designed for overriding by TreeCacheAop. The implementation in this class returns null.

This method will only be invoked if getCacheLoaderFetchTransientState() returns true.

Parameters:
fqn - the fqn that represents the root node of the subtree.
timeout - max number of ms this method should wait to acquire a read lock on the nodes being transferred
force - if a read lock cannot be acquired after timeout ms, should the lock acquisition be forced, and any existing transactions holding locks on the nodes be rolled back? NOTE: In release 1.2.4, this parameter has no effect.
Returns:
a byte[] representing the marshalled form of any "associated" state, or null. This implementation returns null.
Throws:
java.lang.Exception

getReplicationVersion

public java.lang.String getReplicationVersion()
Description copied from interface: TreeCacheMBean
Gets the format version of the data transferred during an initial state transfer or a call to TreeCacheMBean.activateRegion(String). Different releases of JBossCache may format this data differently; this property identifies the format version being used by this cache instance.

The default value for this property is DEFAULT_REPLICATION_VERSION.

Specified by:
getReplicationVersion in interface TreeCacheMBean
Returns:
a short identifying JBossCache release; e.g. 124 for JBossCache 1.2.4

setReplicationVersion

public void setReplicationVersion(java.lang.String versionString)
Description copied from interface: TreeCacheMBean
Sets the format version of the data transferred during an initial state transfer or a call to TreeCacheMBean.activateRegion(String). Different releases of JBossCache may format this data differently; this property identifies the format version being used by this cache instance. Setting this property to a value other than the default allows a cache instance from a later release to interoperate with a cache instance from an earlier release.

Specified by:
setReplicationVersion in interface TreeCacheMBean
Parameters:
versionString - a short identifying JBossCache release; e.g. 124 for JBossCache 1.2.4

getReplicationVersionShort

public short getReplicationVersionShort()

getStateTransferVersion

public short getStateTransferVersion()
Description copied from interface: TreeCacheMBean
Gets the format version of the data transferred during an initial state transfer or a call to TreeCacheMBean.activateRegion(String). Different releases of JBossCache may format this data differently; this property identifies the format version being used by this cache instance.

The default value for this property is DEFAULT_REPLICATION_VERSION.

Specified by:
getStateTransferVersion in interface TreeCacheMBean
Returns:
a short identifying JBossCache release; e.g. 124 for JBossCache 1.2.4

setStateTransferVersion

public void setStateTransferVersion(short version)
Description copied from interface: TreeCacheMBean
Sets the format version of the data transferred during an initial state transfer or a call to TreeCacheMBean.activateRegion(String). Different releases of JBossCache may format this data differently; this property identifies the format version being used by this cache instance. Setting this property to a value other than the default allows a cache instance from a later release to interoperate with a cache instance from an earlier release.

Specified by:
setStateTransferVersion in interface TreeCacheMBean
Parameters:
version - a short identifying JBossCache release; e.g. 124 for JBossCache 1.2.4

acquireLocksForStateTransfer

protected void acquireLocksForStateTransfer(DataNode root,
                                            java.lang.Object lockOwner,
                                            long timeout,
                                            boolean lockChildren,
                                            boolean force)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

releaseStateTransferLocks

protected void releaseStateTransferLocks(DataNode root,
                                         java.lang.Object lockOwner,
                                         boolean childrenLocked)

forceAcquireLock

protected void forceAcquireLock(DataNode node,
                                java.lang.Object newOwner,
                                boolean lockChildren)
Forcibly acquire a read lock on the given node for the given owner, breaking any existing locks that prevent the read lock. If the existing lock is held by a GlobalTransaction, breaking the lock may result in a rollback of the transaction.

Parameters:
node - the node
newOwner - the new owner (usually a Thread or GlobalTransaction)
lockChildren - true if this method should be recursively applied to node's children.

notifyCallForInactiveSubtree

public void notifyCallForInactiveSubtree(java.lang.String fqn)
Method provided to JGroups by TreeCacheMarshaller.objectFromByteBuffer(byte[]) when it receives a replication event for an Fqn that has been marked as inactive. Currently a no-op.

inactivate(Fqn)


fetchStateOnStartup

protected void fetchStateOnStartup()
                            throws java.lang.Exception
Throws:
java.lang.Exception

get

public Node get(java.lang.String fqn)
         throws CacheException
Specified by:
get in interface TreeCacheMBean
Parameters:
fqn - fqn String name to retrieve from cache
Returns:
DataNode corresponding to the fqn. Null if does not exist. No guarantees wrt replication, cache loading are given if the underlying node is modified
Throws:
CacheException

get

public DataNode get(Fqn fqn,
                    Option option)
             throws CacheException
The same as calling get(Fqn) except that you can pass in options for this specific method invocation. Option

Specified by:
get in interface TreeCacheMBean
Parameters:
fqn -
option -
Returns:
Throws:
CacheException

get

public java.lang.Object get(Fqn fqn,
                            java.lang.Object key,
                            Option option)
                     throws CacheException
The same as calling get(Fqn, Object) except that you can pass in options for this specific method invocation. Option

Specified by:
get in interface TreeCacheMBean
Parameters:
fqn -
option -
Returns:
Throws:
CacheException

get

public java.lang.Object get(Fqn fqn,
                            java.lang.Object key,
                            boolean sendNodeEvent,
                            Option option)
                     throws CacheException
The same as calling get(Fqn, Object, boolean) except that you can pass in options for this specific method invocation. Option

Specified by:
get in interface TreeCacheMBean
Parameters:
fqn -
option -
Returns:
Throws:
CacheException

remove

public void remove(Fqn fqn,
                   Option option)
            throws CacheException
The same as calling remove(Fqn) except that you can pass in options for this specific method invocation. Option

Specified by:
remove in interface TreeCacheMBean
Parameters:
fqn -
option -
Throws:
CacheException

remove

public java.lang.Object remove(Fqn fqn,
                               java.lang.Object key,
                               Option option)
                        throws CacheException
The same as calling remove(Fqn, Object) except that you can pass in options for this specific method invocation. Option

Specified by:
remove in interface TreeCacheMBean
Parameters:
fqn -
key -
option -
Throws:
CacheException

getChildrenNames

public java.util.Set getChildrenNames(Fqn fqn,
                                      Option option)
                               throws CacheException
The same as calling getChildrenNames(Fqn) except that you can pass in options for this specific method invocation. Option

Specified by:
getChildrenNames in interface TreeCacheMBean
Parameters:
fqn -
option -
Returns:
Throws:
CacheException

put

public void put(Fqn fqn,
                java.util.Map data,
                Option option)
         throws CacheException
The same as calling put(Fqn, Map) except that you can pass in options for this specific method invocation. Option

Specified by:
put in interface TreeCacheMBean
Parameters:
fqn -
data -
option -
Throws:
CacheException

put

public void put(Fqn fqn,
                java.lang.Object key,
                java.lang.Object value,
                Option option)
         throws CacheException
The same as calling put(Fqn, Object, Object) except that you can pass in options for this specific method invocation. Option

Specified by:
put in interface TreeCacheMBean
Parameters:
fqn -
key -
value -
option -
Throws:
CacheException

get

public Node get(Fqn fqn)
         throws CacheException
Specified by:
get in interface TreeCacheMBean
Parameters:
fqn - fqn instance to retrieve from cache
Returns:
DataNode corresponding to the fqn. Null if does not exist. No guarantees wrt replication, cache loading are given if the underlying node is modified
Throws:
CacheException

_get

public Node _get(Fqn fqn)
          throws CacheException
Throws:
CacheException

_getData

public java.util.Map _getData(Fqn fqn)

getKeys

public java.util.Set getKeys(java.lang.String fqn)
                      throws CacheException
Specified by:
getKeys in interface TreeCacheMBean
Parameters:
fqn -
Throws:
CacheException

getKeys

public java.util.Set getKeys(Fqn fqn)
                      throws CacheException
Specified by:
getKeys in interface TreeCacheMBean
Parameters:
fqn -
Returns:
A Set of keys. This is a copy of the key set, modifications will not be written to the original. Returns null if the node is not found, or the node has no attributes
Throws:
CacheException

_getKeys

public java.util.Set _getKeys(Fqn fqn)
                       throws CacheException
Throws:
CacheException

get

public java.lang.Object get(java.lang.String fqn,
                            java.lang.Object key)
                     throws CacheException
Finds a node given its name and returns the value associated with a given key in its data map. Returns null if the node was not found in the tree or the key was not found in the hashmap.

Specified by:
get in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node.
key - The key.
Throws:
CacheException

get

public java.lang.Object get(Fqn fqn,
                            java.lang.Object key)
                     throws CacheException
Finds a node given its name and returns the value associated with a given key in its data map. Returns null if the node was not found in the tree or the key was not found in the hashmap.

Specified by:
get in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node.
key - The key.
Throws:
CacheException

_get

public java.lang.Object _get(Fqn fqn,
                             java.lang.Object key,
                             boolean sendNodeEvent)
                      throws CacheException
Throws:
CacheException

get

protected java.lang.Object get(Fqn fqn,
                               java.lang.Object key,
                               boolean sendNodeEvent)
                        throws CacheException
Throws:
CacheException

peek

public java.lang.Object peek(Fqn fqn,
                             java.lang.Object key)
                      throws CacheException
Like get() method but without triggering a node visit event. This is used to prevent refresh of the cache data in the eviction policy.

Parameters:
fqn -
key -
Throws:
CacheException

peek

public DataNode peek(Fqn fqn)

exists

public boolean exists(java.lang.String fqn)
Checks whether a given node exists in the tree

Specified by:
exists in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node
Returns:
boolean Whether or not the node exists

exists

public boolean exists(Fqn fqn)
Checks whether a given node exists in the tree. Does not acquire any locks in doing so (result may be dirty read)

Specified by:
exists in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node
Returns:
boolean Whether or not the node exists

exists

public boolean exists(java.lang.String fqn,
                      java.lang.Object key)
Specified by:
exists in interface TreeCacheMBean
Parameters:
fqn -
key -

exists

public boolean exists(Fqn fqn,
                      java.lang.Object key)
Checks whether a given key exists in the given node. Does not interact with CacheLoader, so the behavior is different from get(Fqn,Object)

Specified by:
exists in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node
key -
Returns:
boolean Whether or not the node exists

put

public void put(java.lang.String fqn,
                java.util.Map data)
         throws CacheException
Adds a new node to the tree and sets its data. If the node doesn not yet exist, it will be created. Also, parent nodes will be created if not existent. If the node already has data, then the new data will override the old one. If the node already existed, a nodeModified() notification will be generated. Otherwise a nodeCreated() motification will be emitted.

Specified by:
put in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the new node
data - The new data. May be null if no data should be set in the node.
Throws:
CacheException

put

public void put(Fqn fqn,
                java.util.Map data)
         throws CacheException
Adds a new node to the tree and sets its data. If the node doesn not yet exist, it will be created. Also, parent nodes will be created if not existent. If the node already has data, then the new data will override the old one. If the node already existed, a nodeModified() notification will be generated. Otherwise a nodeCreated() motification will be emitted.

Specified by:
put in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the new node
data - The new data. May be null if no data should be set in the node.
Throws:
CacheException

put

public java.lang.Object put(java.lang.String fqn,
                            java.lang.Object key,
                            java.lang.Object value)
                     throws CacheException
Adds a key and value to a given node. If the node doesn't exist, it will be created. If the node already existed, a nodeModified() notification will be generated. Otherwise a nodeCreated() motification will be emitted.

Specified by:
put in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node
key - The key
value - The value
Returns:
Object The previous value (if any), if node was present
Throws:
CacheException

putFailFast

public java.lang.Object putFailFast(Fqn fqn,
                                    java.lang.Object key,
                                    java.lang.Object value,
                                    long timeout)
                             throws CacheException
Deprecated. This is a kludge created specifically form the Hibernate 3.0 release. This method should not be used by any application. The methodV will likely be removed in a future release

Put with the following properties:
  1. Fails fast (after timeout milliseconds)
  2. If replication is used: replicates asynchronously, overriding a potential synchronous mode
This method should be used without running in a transaction (suspend()/resume() before calling it)

Parameters:
fqn - The fully qualified name of the node
key -
value -
timeout - Number of milliseconds to wait until a lock has been acquired. A TimeoutException will be thrown if not successful. 0 means to wait forever
Returns:
Throws:
CacheException

putFailFast

public java.lang.Object putFailFast(java.lang.String fqn,
                                    java.lang.Object key,
                                    java.lang.Object value,
                                    long timeout)
                             throws CacheException
Deprecated. 

Parameters:
fqn -
key -
value -
timeout -
Returns:
Throws:
CacheException

put

public java.lang.Object put(Fqn fqn,
                            java.lang.Object key,
                            java.lang.Object value)
                     throws CacheException
Adds a key and value to a given node. If the node doesn't exist, it will be created. If the node already existed, a nodeModified() notification will be generated. Otherwise a nodeCreated() motification will be emitted.

Specified by:
put in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node
key - The key
value - The value
Returns:
Object The previous value (if any), if node was present
Throws:
CacheException

remove

public void remove(java.lang.String fqn)
            throws CacheException
Removes the node from the tree.

Specified by:
remove in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node.
Throws:
CacheException

remove

public void remove(Fqn fqn)
            throws CacheException
Removes the node from the tree.

Specified by:
remove in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node.
Throws:
CacheException

evict

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.

Specified by:
evict in interface TreeCacheMBean
Parameters:
fqn - Will remove everythign assoicated with this fqn.
Throws:
CacheException

remove

public java.lang.Object remove(java.lang.String fqn,
                               java.lang.Object key)
                        throws CacheException
Removes key from the node's hashmap

Specified by:
remove in interface TreeCacheMBean
Parameters:
fqn - The fullly qualified name of the node
key - The key to be removed
Returns:
The previous value, or null if none was associated with the given key
Throws:
CacheException

remove

public java.lang.Object remove(Fqn fqn,
                               java.lang.Object key)
                        throws CacheException
Removes key from the node's hashmap

Specified by:
remove in interface TreeCacheMBean
Parameters:
fqn - The fullly qualified name of the node
key - The key to be removed
Returns:
The previous value, or null if none was associated with the given key
Throws:
CacheException

removeData

public void removeData(java.lang.String fqn)
                throws CacheException
Specified by:
removeData in interface TreeCacheMBean
Parameters:
fqn -
Throws:
CacheException

removeData

public void removeData(Fqn fqn)
                throws CacheException
Specified by:
removeData in interface TreeCacheMBean
Parameters:
fqn -
Throws:
CacheException

releaseAllLocks

public void releaseAllLocks(java.lang.String fqn)
Force-releases all locks in this node and the entire subtree

Specified by:
releaseAllLocks in interface TreeCacheMBean
Parameters:
fqn -

releaseAllLocks

public void releaseAllLocks(Fqn fqn)
Force-releases all locks in this node and the entire subtree

Specified by:
releaseAllLocks in interface TreeCacheMBean
Parameters:
fqn -

print

public java.lang.String print(java.lang.String fqn)
Prints a representation of the node defined by fqn. Output includes name, fqn and data.

Specified by:
print in interface TreeCacheMBean

print

public java.lang.String print(Fqn fqn)
Prints a representation of the node defined by fqn. Output includes name, fqn and data.

Specified by:
print in interface TreeCacheMBean

getChildrenNames

public java.util.Set getChildrenNames(java.lang.String fqn)
                               throws CacheException
Returns all children of a given node

Specified by:
getChildrenNames in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node
Returns:
Set A list of child names (as Strings)
Throws:
CacheException

getChildrenNames

public java.util.Set getChildrenNames(Fqn fqn)
                               throws CacheException
Returns all children of a given node

Specified by:
getChildrenNames in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node
Returns:
Set A list of child names (as Objects). Must not be modified because this would modify the underlying node directly (will throw an exception if modification is attempted). Returns null of the parent node was not found, or if there are no children
Throws:
CacheException

_getChildrenNames

public java.util.Set _getChildrenNames(Fqn fqn)
                                throws CacheException
Throws:
CacheException

hasChild

public boolean hasChild(Fqn fqn)

toString

public java.lang.String toString()
Specified by:
toString in interface TreeCacheMBean
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(boolean details)

printDetails

public java.lang.String printDetails()
Specified by:
printDetails in interface TreeCacheMBean

printLockInfo

public java.lang.String printLockInfo()
Specified by:
printLockInfo in interface TreeCacheMBean

getNumberOfLocksHeld

public int getNumberOfLocksHeld()
Gets the number of read or write locks held across the entire tree

Specified by:
getNumberOfLocksHeld in interface TreeCacheMBean

getNumberOfNodes

public int getNumberOfNodes()
Returns an approximation of the total number of nodes in the tree. Since this method doesn't acquire any locks, the number might be incorrect, or the method might even throw a ConcurrentModificationException

Specified by:
getNumberOfNodes in interface TreeCacheMBean

getNumberOfAttributes

public int getNumberOfAttributes()
Returns an approximation of the total number of attributes in the tree. Since this method doesn't acquire any locks, the number might be incorrect, or the method might even throw a ConcurrentModificationException

Specified by:
getNumberOfAttributes in interface TreeCacheMBean

getNumberOfAttributes

public int getNumberOfAttributes(Fqn fqn)

callRemoteMethods

public java.util.List callRemoteMethods(java.util.Vector mbrs,
                                        org.jgroups.blocks.MethodCall method_call,
                                        boolean synchronous,
                                        boolean exclude_self,
                                        long timeout)
                                 throws java.lang.Exception
Deprecated. Note this is due to be moved to an interceptor.

Parameters:
mbrs -
method_call -
synchronous -
exclude_self -
timeout -
Returns:
Throws:
java.lang.Exception

callRemoteMethods

public java.util.List callRemoteMethods(java.util.Vector mbrs,
                                        org.jgroups.blocks.MethodCall method_call,
                                        int mode,
                                        boolean exclude_self,
                                        long timeout)
                                 throws java.lang.Exception
Deprecated. Note this is due to be moved to an interceptor.

Overloaded to allow a finer grained control over JGroups mode

Parameters:
mbrs -
method_call -
mode -
exclude_self -
timeout -
Returns:
Throws:
java.lang.Exception

callRemoteMethods

public java.util.List callRemoteMethods(java.util.Vector members,
                                        java.lang.reflect.Method method,
                                        java.lang.Object[] args,
                                        boolean synchronous,
                                        boolean exclude_self,
                                        long timeout)
                                 throws java.lang.Exception
Deprecated. Note this is due to be moved to an interceptor.

Specified by:
callRemoteMethods in interface TreeCacheMBean
Parameters:
members -
method -
args -
synchronous -
exclude_self -
timeout -
Returns:
Throws:
java.lang.Exception

callRemoteMethods

public java.util.List callRemoteMethods(java.util.Vector members,
                                        java.lang.String method_name,
                                        java.lang.Class[] types,
                                        java.lang.Object[] args,
                                        boolean synchronous,
                                        boolean exclude_self,
                                        long timeout)
                                 throws java.lang.Exception
Deprecated. Note this is due to be moved to an interceptor.

Specified by:
callRemoteMethods in interface TreeCacheMBean
Parameters:
members -
method_name -
types -
args -
synchronous -
exclude_self -
timeout -
Returns:
Throws:
java.lang.Exception

_put

public void _put(GlobalTransaction tx,
                 java.lang.String fqn,
                 java.util.Map data,
                 boolean create_undo_ops)
          throws CacheException
Does the real work. Needs to acquire locks if accessing nodes, depending on the value of locking. If run inside a transaction, needs to (a) add newly acquired locks to TransactionEntry's lock list, (b) add nodes that were created to TransactionEntry's node list and (c) create Modifications and add them to TransactionEntry's modification list and (d) create compensating modifications to undo the changes in case of a rollback

Specified by:
_put in interface TreeCacheMBean
Parameters:
fqn -
data -
create_undo_ops - If true, undo operations will be created (default is true). Otherwise they will not be created (used by rollback()).
Throws:
CacheException

_put

public void _put(GlobalTransaction tx,
                 Fqn fqn,
                 java.util.Map data,
                 boolean create_undo_ops)
          throws CacheException
Does the real work. Needs to acquire locks if accessing nodes, depending on the value of locking. If run inside a transaction, needs to (a) add newly acquired locks to TransactionEntry's lock list, (b) add nodes that were created to TransactionEntry's node list and (c) create Modifications and add them to TransactionEntry's modification list and (d) create compensating modifications to undo the changes in case of a rollback

Specified by:
_put in interface TreeCacheMBean
Parameters:
fqn -
data -
create_undo_ops - If true, undo operations will be created (default is true). Otherwise they will not be created (used by rollback()).
Throws:
CacheException

_put

public void _put(GlobalTransaction tx,
                 Fqn fqn,
                 java.util.Map data,
                 boolean create_undo_ops,
                 boolean erase_contents)
          throws CacheException
Does the real work. Needs to acquire locks if accessing nodes, depending on the value of locking. If run inside a transaction, needs to (a) add newly acquired locks to TransactionEntry's lock list, (b) add nodes that were created to TransactionEntry's node list and (c) create Modifications and add them to TransactionEntry's modification list and (d) create compensating modifications to undo the changes in case of a rollback

Specified by:
_put in interface TreeCacheMBean
Parameters:
fqn -
data -
create_undo_ops - If true, undo operations will be created (default is true).
erase_contents - Clear the existing hashmap before putting the new data into it Otherwise they will not be created (used by rollback()).
Throws:
CacheException

_put

public java.lang.Object _put(GlobalTransaction tx,
                             java.lang.String fqn,
                             java.lang.Object key,
                             java.lang.Object value,
                             boolean create_undo_ops)
                      throws CacheException
Specified by:
_put in interface TreeCacheMBean
Parameters:
fqn -
key -
value -
Returns:
Previous value (if any)
Throws:
CacheException

_put

public java.lang.Object _put(GlobalTransaction tx,
                             Fqn fqn,
                             java.lang.Object key,
                             java.lang.Object value,
                             boolean create_undo_ops)
                      throws CacheException
Specified by:
_put in interface TreeCacheMBean
Parameters:
fqn -
key -
value -
Returns:
Previous value (if any)
Throws:
CacheException

_put

public java.lang.Object _put(GlobalTransaction tx,
                             Fqn fqn,
                             java.lang.Object key,
                             java.lang.Object value,
                             boolean create_undo_ops,
                             long timeout)
                      throws CacheException
Throws:
CacheException

_remove

public void _remove(GlobalTransaction tx,
                    java.lang.String fqn,
                    boolean create_undo_ops)
             throws CacheException
Specified by:
_remove in interface TreeCacheMBean
Parameters:
fqn -
Throws:
CacheException

_remove

public void _remove(GlobalTransaction tx,
                    Fqn fqn,
                    boolean create_undo_ops)
             throws CacheException
Specified by:
_remove in interface TreeCacheMBean
Parameters:
fqn -
Throws:
CacheException

_remove

public void _remove(GlobalTransaction tx,
                    Fqn fqn,
                    boolean create_undo_ops,
                    boolean sendNodeEvent)
             throws CacheException
Throws:
CacheException

_remove

public void _remove(GlobalTransaction tx,
                    Fqn fqn,
                    boolean create_undo_ops,
                    boolean sendNodeEvent,
                    boolean eviction)
             throws CacheException
Remove a node

Parameters:
tx -
fqn -
create_undo_ops -
sendNodeEvent -
Throws:
CacheException

_remove

public void _remove(GlobalTransaction tx,
                    Fqn fqn,
                    boolean create_undo_ops,
                    boolean sendNodeEvent,
                    boolean eviction,
                    DataVersion version)
             throws CacheException
// TODO: MANIK: Document this methodcall

Parameters:
tx -
fqn -
create_undo_ops -
sendNodeEvent -
eviction -
version -
Throws:
CacheException

_remove

public java.lang.Object _remove(GlobalTransaction tx,
                                java.lang.String fqn,
                                java.lang.Object key,
                                boolean create_undo_ops)
                         throws CacheException
Specified by:
_remove in interface TreeCacheMBean
Parameters:
fqn -
key -
Returns:
Object
Throws:
CacheException

_remove

public java.lang.Object _remove(GlobalTransaction tx,
                                Fqn fqn,
                                java.lang.Object key,
                                boolean create_undo_ops)
                         throws CacheException
Specified by:
_remove in interface TreeCacheMBean
Parameters:
fqn -
key -
Returns:
Object
Throws:
CacheException

_removeData

public void _removeData(GlobalTransaction tx,
                        java.lang.String fqn,
                        boolean create_undo_ops)
                 throws CacheException
Parameters:
fqn -
Throws:
CacheException

_removeData

public void _removeData(GlobalTransaction tx,
                        Fqn fqn,
                        boolean create_undo_ops)
                 throws CacheException
Parameters:
fqn -
Throws:
CacheException

_removeData

public void _removeData(GlobalTransaction tx,
                        Fqn fqn,
                        boolean create_undo_ops,
                        boolean sendNodeEvent)
                 throws CacheException
Throws:
CacheException

_removeData

public void _removeData(GlobalTransaction tx,
                        Fqn fqn,
                        boolean create_undo_ops,
                        boolean sendNodeEvent,
                        boolean eviction)
                 throws CacheException
Throws:
CacheException

_removeData

public void _removeData(GlobalTransaction tx,
                        Fqn fqn,
                        boolean create_undo_ops,
                        boolean sendNodeEvent,
                        boolean eviction,
                        DataVersion version)
                 throws CacheException
Throws:
CacheException

_evict

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.

Parameters:
fqn - Will remove everything assoicated with this fqn.
Throws:
CacheException

_evict

public void _evict(Fqn fqn,
                   DataVersion version)
            throws CacheException
// TODO: MANIK: Document this methodcall

Parameters:
fqn -
version -
Throws:
CacheException

_addChild

public void _addChild(GlobalTransaction tx,
                      Fqn parent_fqn,
                      java.lang.Object child_name,
                      DataNode old_node)
               throws CacheException
Compensating method to _remove(GlobalTransaction,Fqn,boolean). This is package-private on purpose because it is only supposed to be called inside the same VM (by rollback(GlobalTransaction) ).

Parameters:
parent_fqn -
child_name -
old_node -
Throws:
CacheException

_replicate

public java.lang.Object _replicate(org.jgroups.blocks.MethodCall method_call)
                            throws java.lang.Throwable
Invoked by the ReplicationInterceptor of other nodes in the cluster, to replicate their changes across the cluster. Needs to be forwarded to the ReplicationInterceptor in this interceptor chain.
This method will later be moved entirely into the ReplicationInterceptor.

Parameters:
method_call -
Returns:
Throws:
java.lang.Throwable

_replicate

public void _replicate(java.util.List method_calls)
                throws java.lang.Throwable
Throws:
java.lang.Throwable

_clusteredGet

public java.util.List _clusteredGet(org.jgroups.blocks.MethodCall call)
A 'clustered get' call, received from a remote ClusteredCacheLoader.

Parameters:
call -
Returns:
a List containing 2 elements: (Boolean.TRUE or Boolean.FALSE) and a value (Object).

_releaseAllLocks

public void _releaseAllLocks(Fqn fqn)

_print

public java.lang.String _print(Fqn fqn)

_lock

public void _lock(Fqn fqn,
                  int lock_type,
                  boolean recursive)
           throws TimeoutException,
                  LockingException
Throws:
TimeoutException
LockingException

optimisticPrepare

public void optimisticPrepare(GlobalTransaction gtx,
                              java.util.List modifications,
                              java.util.Map data,
                              org.jgroups.Address address,
                              boolean onePhaseCommit)

prepare

public void prepare(GlobalTransaction global_tx,
                    java.util.List modifications,
                    org.jgroups.Address coord,
                    boolean onePhaseCommit)

commit

public void commit(GlobalTransaction tx)

rollback

public void rollback(GlobalTransaction tx)

addUndoOperation

public void addUndoOperation(GlobalTransaction gtx,
                             org.jgroups.blocks.MethodCall undo_op)

getCacheLoaderManager

public CacheLoaderManager getCacheLoaderManager()

setCacheLoaderManager

public void setCacheLoaderManager(CacheLoaderManager cacheLoaderManager)

viewAccepted

public void viewAccepted(org.jgroups.View new_view)
Specified by:
viewAccepted in interface org.jgroups.MembershipListener

suspect

public void suspect(org.jgroups.Address suspected_mbr)
Called when a member is suspected

Specified by:
suspect in interface org.jgroups.MembershipListener

block

public void block()
Block sending and receiving of messages until viewAccepted() is called

Specified by:
block in interface org.jgroups.MembershipListener

getLocalTransaction

protected javax.transaction.Transaction getLocalTransaction()
Returns the transaction associated with the current thread. We get the initial context and a reference to the TransactionManager to get the transaction. This method is used by getCurrentTransaction()


getCurrentTransaction

public GlobalTransaction getCurrentTransaction()
Get the transaction associated with the current thread and maps it onto a GlobalTransaction. The mapping is maintained in the tx_map table. If a local transaction exists, but doesn't yet have a mapping to a GlobalTransaction, a new GlobalTransaction will be created and mapped to the local transaction. Note that if a local transaction exists, but is not ACTIVE or PREPARING, null is returned too.

Returns:
A GlobalTransaction, or null if no (local) transaction was associated with the current thread

getCurrentTransaction

public GlobalTransaction getCurrentTransaction(boolean createIfNotExists)

getCurrentTransaction

public GlobalTransaction getCurrentTransaction(javax.transaction.Transaction tx)

getCurrentTransaction

public GlobalTransaction getCurrentTransaction(javax.transaction.Transaction tx,
                                               boolean createIfNotExists)

invokeMethod

protected java.lang.Object invokeMethod(org.jgroups.blocks.MethodCall m)
                                 throws CacheException
Invokes a method against this object. Contains the logger_ic for handling the various use cases, e.g. mode (local, repl_async, repl_sync), transaction (yes or no) and locking (yes or no).

Parameters:
m -
Returns:
Throws:
CacheException

getOwnerForLock

protected java.lang.Object getOwnerForLock()
Returns an object suitable for use in node locking, either the current transaction or the current thread if there is no transaction.


loadClass

protected java.lang.Class loadClass(java.lang.String classname)
                             throws java.lang.ClassNotFoundException
Loads the specified class using this class's classloader, or, if it is null (i.e. this class was loaded by the bootstrap classloader), the system classloader.

If loadtime instrumentation via GenerateInstrumentedClassLoader is used, this class may be loaded by the bootstrap classloader.

Throws:
java.lang.ClassNotFoundException

getRegionManager

public RegionManager getRegionManager()

getEvictionRegionManager

public RegionManager getEvictionRegionManager()

notifyNodeCreated

public void notifyNodeCreated(Fqn fqn)

notifyNodeLoaded

public void notifyNodeLoaded(Fqn fqn)

notifyNodeActivate

public void notifyNodeActivate(Fqn fqn,
                               boolean pre)

notifyNodePassivate

public void notifyNodePassivate(Fqn fqn,
                                boolean pre)

notifyNodeRemove

protected void notifyNodeRemove(Fqn fqn,
                                boolean pre)

notifyNodeRemoved

protected void notifyNodeRemoved(Fqn fqn)

notifyNodeEvict

protected void notifyNodeEvict(Fqn fqn,
                               boolean pre)

notifyNodeEvicted

protected void notifyNodeEvicted(Fqn fqn)

notifyNodeModify

protected void notifyNodeModify(Fqn fqn,
                                boolean pre)

notifyNodeModified

protected void notifyNodeModified(Fqn fqn)

notifyNodeVisited

protected void notifyNodeVisited(Fqn fqn)

notifyCacheStarted

protected void notifyCacheStarted()

notifyCacheStopped

protected void notifyCacheStopped()

notifyViewChange

protected void notifyViewChange(org.jgroups.View v)

notifyAllNodesCreated

protected void notifyAllNodesCreated(DataNode curr)
Generates NodeAdded notifications for all nodes of the tree. This is called whenever the tree is initially retrieved (state transfer)


getDefaultProperties

protected java.lang.String getDefaultProperties()

string2Mode

protected int string2Mode(java.lang.String mode)

setInvocationContext

public void setInvocationContext(InvocationContext invocationContext)
Sets the invocation context

Parameters:
invocationContext -

getInvocationContext

public InvocationContext getInvocationContext()
Retrieves an InvocationContext.

Returns:
the context for the current invocation

setCacheLoaderClass

public void setCacheLoaderClass(java.lang.String cache_loader_class)
Deprecated. 

Specified by:
setCacheLoaderClass in interface TreeCacheMBean
See Also:
{#setCacheLoaderConfig(Element e)}, the preferred way to configure cache loaders.

setCacheLoaderConfig

public void setCacheLoaderConfig(java.util.Properties cache_loader_config)
Deprecated. 

Specified by:
setCacheLoaderConfig in interface TreeCacheMBean
See Also:
{#setCacheLoaderConfig(Element e)}, the preferred way to configure cache loaders.

setCacheLoaderShared

public void setCacheLoaderShared(boolean shared)
Deprecated. 

Specified by:
setCacheLoaderShared in interface TreeCacheMBean
See Also:
{#setCacheLoaderConfig(Element e)}, the preferred way to configure cache loaders.

setCacheLoaderPassivation

public void setCacheLoaderPassivation(boolean passivate)
Deprecated. 

Specified by:
setCacheLoaderPassivation in interface TreeCacheMBean
See Also:
{#setCacheLoaderConfig(Element e)}, the preferred way to configure cache loaders.

setCacheLoaderPreload

public void setCacheLoaderPreload(java.lang.String list)
Deprecated. 

Specified by:
setCacheLoaderPreload in interface TreeCacheMBean
See Also:
{#setCacheLoaderConfig(Element e)}, the preferred way to configure cache loaders.

setCacheLoaderAsynchronous

public void setCacheLoaderAsynchronous(boolean b)
Deprecated. 

Specified by:
setCacheLoaderAsynchronous in interface TreeCacheMBean
See Also:
{#setCacheLoaderConfig(Element e)}, the preferred way to configure cache loaders.

setCacheLoaderFetchPersistentState

public void setCacheLoaderFetchPersistentState(boolean flag)
Deprecated. 

Specified by:
setCacheLoaderFetchPersistentState in interface TreeCacheMBean
See Also:
{#setCacheLoaderConfig(Element e)}, the preferred way to configure cache loaders.

setCacheLoaderFetchTransientState

public void setCacheLoaderFetchTransientState(boolean flag)
Deprecated. 

Specified by:
setCacheLoaderFetchTransientState in interface TreeCacheMBean
See Also:
{#setCacheLoaderConfig(Element e)}, the preferred way to configure cache loaders.

setCacheLoader

public void setCacheLoader(CacheLoader loader)
Deprecated. 

Provided for backwards compat.

Specified by:
setCacheLoader in interface TreeCacheMBean
Parameters:
loader -

getCacheLoaderClass

public java.lang.String getCacheLoaderClass()
Deprecated. 

provided for backward compat. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderClass in interface TreeCacheMBean

getCacheLoaderShared

public boolean getCacheLoaderShared()
Deprecated. 

provided for backward compat. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderShared in interface TreeCacheMBean

getCacheLoaderPassivation

public boolean getCacheLoaderPassivation()
Deprecated. 

provided for backward compat. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderPassivation in interface TreeCacheMBean

getCacheLoaderAsynchronous

public boolean getCacheLoaderAsynchronous()
Deprecated. 

provided for backward compat. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderAsynchronous in interface TreeCacheMBean

getCacheLoaderPreload

public java.lang.String getCacheLoaderPreload()
Deprecated. 

provided for backward compat. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderPreload in interface TreeCacheMBean

getCacheLoaderFetchPersistentState

public boolean getCacheLoaderFetchPersistentState()
Deprecated. 

provided for backward compat. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderFetchPersistentState in interface TreeCacheMBean

getCacheLoaderFetchTransientState

public boolean getCacheLoaderFetchTransientState()
Deprecated. 

provided for backward compat. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderFetchTransientState in interface TreeCacheMBean

getCacheLoaderConfig

public java.util.Properties getCacheLoaderConfig()
Description copied from interface: TreeCacheMBean
provided for backward compat. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderConfig in interface TreeCacheMBean


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.