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, PojoCache, RpcTreeCache

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 are multicast to all group members reliably and in order. User has the option to set transaction isolation levels and other options.

Version:
$Id: TreeCache.java,v 1.195.2.4 2006/07/07 07:03:43 bstansberry Exp $

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

Field Summary
protected  java.util.Set activationChangeNodes
          Set of Fqns of nodes that are currently being processed by activateReqion or inactivateRegion.
protected  BuddyManager buddyManager
          Buddy Manager
protected  org.w3c.dom.Element buddyReplicationConfig
          Buddy replication configuration XML element
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
          The JGroups JChannel in use.
protected  CacheLoaderConfig cloaderConfig
          for legacy use *
protected  java.lang.String cluster_name
          Default cluster name.
protected  java.lang.String cluster_props
          Default cluster properties.
protected  boolean coordinator
          True if this TreeCache is the coordinator.
static short DEFAULT_REPLICATION_VERSION
          Default replication version, from Version.getVersionShort().
protected  org.jgroups.blocks.RpcDispatcher disp
          JGroups RpcDispatcher in use.
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  java.lang.String evictionInterceptorClass
           
protected  RegionManager evictionRegionManager_
          RegionManager used by cache eviction
protected  boolean fetchInMemoryState
           
protected  boolean hasListeners
          True if listeners are initialized.
protected  boolean inactiveOnStartup
           
protected  Interceptor interceptor_chain
          invokeMethod(MethodCall) will dispatch to this chain of interceptors.
protected  java.util.Set internalFqns
          Set of Fqns of the topmost node of internal regions that should not included in standard state transfers.
static int INVALIDATION_ASYNC
          Cache sends evict(org.jboss.cache.Fqn) calls to remote caches when a node is changed.
static int INVALIDATION_SYNC
          Cache sends evict(org.jboss.cache.Fqn) calls to remote caches when a node is changed.
protected  IsolationLevel isolationLevel
          Isolation level in use, default is IsolationLevel.REPEATABLE_READ.
protected  boolean isStandalone
           
protected  boolean isStateSet
          True if state was initialized during start-up.
static int LOCAL
          Entries in the cache are by default local and not replicated.
protected  long lock_acquisition_timeout
           
protected static org.apache.commons.logging.Log log
          TreeCache log.
protected  VersionAwareMarshaller marshaller_
          Marshaller if register to handle marshalling
protected  java.util.Vector members
          List of cluster group members.
protected  org.jgroups.MessageListener ml
          JGroups message listener.
protected  java.lang.String mux_serviceName
          The JGroups multiplexer service name; null if the multiplexer isn't used
protected  java.lang.String mux_stackName
          The JGroups multiplexer stack name, default is "fc-fast-minimalthreads"
protected  boolean nodeLockingOptimistic
          Determines whether to use optimistic locking or not.
protected  RegionManager regionManager_
          RegionManager used by marshaller and ExtendedCacheLoader
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
          Replicated element queue interval.
protected  int repl_queue_max_elements
          Maximum number of replicated elements to queue.
static int REPL_SYNC
          Entries in the cache are by default replicated synchronously.
protected  DataNode root
          Root DataNode.
static java.lang.String SEPARATOR
          Deprecated. use Fqn.SEPARATOR.
protected  java.lang.Exception setStateException
          An exception occuring upon fetch state.
protected  long state_fetch_timeout
           
protected  boolean sync_commit_phase
          True if there is a synchronous commit phase, otherwise asynchronous commit.
protected  long sync_repl_timeout
           
protected  boolean sync_rollback_phase
          True if there is a synchronous rollback phase, otherwise asynchronous rollback.
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
          Uninitialized node key.
protected  boolean use_interceptor_mbeans
          True if MBean interceptors are used.
protected  boolean use_repl_queue
          True if replication is queued.
protected  boolean useCreateService
          _createService was called.
protected  boolean useRegionBasedMarshalling
          True if we use region based marshalling.
protected  boolean usingEviction
           
 
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()
          Constructs an uninitialized TreeCache.
TreeCache(org.jgroups.JChannel channel)
          Constructs a TreeCache with an already connected channel.
TreeCache(java.lang.String cluster_name, java.lang.String props, long state_fetch_timeout)
          Creates a channel with the given cluster name, properties, and state fetch timeout.
 
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 methodCall, java.lang.Boolean searchBackupSubtrees)
          A 'clustered get' call, called from a remote ClusteredCacheLoader.
protected  void _createService()
           
 void _dataGravitationCleanup(GlobalTransaction gtx, Fqn primary, Fqn backup)
           
 void _enqueueMethodCall(java.lang.String subtree, org.jgroups.blocks.MethodCall call)
          Called internally to enqueue a method call.
 void _evict(Fqn fqn)
          Internal evict method called by eviction policy provider.
 void _evict(Fqn fqn, DataVersion version)
          Internal evict method called by eviction policy provider.
protected  void _evictSubtree(Fqn subtree)
          Evicts the node at subtree along with all descendant nodes.
 Node _get(Fqn fqn)
          Returns the raw data of the node; called externally internally.
 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)
          Returns the raw data of the node; called externally internally.
 java.util.Set _getKeys(Fqn fqn)
           
 byte[] _getState(Fqn fqn, boolean fetchTransientState, boolean fetchPersistentState, long timeout, boolean force, boolean suppressErrors)
          Returns the state for the portion of the tree named by fqn.
 byte[] _getState(Fqn fqn, long timeout, boolean force, boolean suppressErrors)
          Returns the state for the portion of the tree named by fqn.
 java.util.List _gravitateData(Fqn fqn, boolean searchSubtrees, boolean marshal)
          Used with buddy replication's data gravitation interceptor
 void _loadState(Fqn subtreeRoot, DataNode integrationRoot, java.lang.Object[] sources, java.lang.ClassLoader cl)
          Requests state from each of the given source nodes in the cluster until it gets it or no node replies with a timeout exception.
 void _loadState(Fqn subtreeRoot, Fqn integrationRoot, java.lang.Object[] sources, java.lang.ClassLoader cl)
          Requests state from each of the given source nodes in the cluster until it gets it or no node replies with a timeout exception.
 void _lock(Fqn fqn, int lock_type, boolean recursive)
          Should not be called.
 java.lang.String _print(Fqn fqn)
          Finds and returns the org.jboss.cache.DataNode#toString() value for the Fqn.
 void _put(GlobalTransaction tx, Fqn fqn, java.util.Map data, boolean create_undo_ops)
          Internal put method.
 void _put(GlobalTransaction tx, Fqn fqn, java.util.Map data, boolean create_undo_ops, boolean erase_contents)
          Internal put method.
 java.lang.Object _put(GlobalTransaction tx, Fqn fqn, java.lang.Object key, java.lang.Object value, boolean create_undo_ops)
          Internal put method.
 java.lang.Object _put(GlobalTransaction tx, Fqn fqn, java.lang.Object key, java.lang.Object value, boolean create_undo_ops, long timeout)
          Internal put method.
 void _put(GlobalTransaction tx, java.lang.String fqn, java.util.Map data, boolean create_undo_ops)
          Internal put method.
 java.lang.Object _put(GlobalTransaction tx, java.lang.String fqn, java.lang.Object key, java.lang.Object value, boolean create_undo_ops)
          Internal put method.
 void _releaseAllLocks(Fqn fqn)
          Releases all locks for a FQN.
 void _remoteAnnounceBuddyPoolName(org.jgroups.stack.IpAddress address, java.lang.String buddyPoolName)
           
 void _remoteAssignToBuddyGroup(BuddyGroup group, java.util.Map state)
          Performs a search.
 void _remoteRemoveFromBuddyGroup(java.lang.String groupName)
           
 void _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops)
          Internal remove method.
 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)
          Internal method to remove a node.
 void _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction, DataVersion version)
          Internal method to remove a node.
 java.lang.Object _remove(GlobalTransaction tx, Fqn fqn, java.lang.Object key, boolean create_undo_ops)
          Internal method to remove a key.
 void _remove(GlobalTransaction tx, java.lang.String fqn, boolean create_undo_ops)
          Internal remove method.
 java.lang.Object _remove(GlobalTransaction tx, java.lang.String fqn, java.lang.Object key, boolean create_undo_ops)
          Internal method to remove a key.
 void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops)
          Internal method to remove data from a node.
 void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent)
          Internal method to remove data from a node.
 void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction)
          Internal method to remove data from a node.
 void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction, DataVersion version)
          Internal method to remove data from a node.
 void _removeData(GlobalTransaction tx, java.lang.String fqn, boolean create_undo_ops)
          Internal method to remove data from a node.
 void _replicate(java.util.List method_calls)
          Replicates a list of method calls.
 java.lang.Object _replicate(org.jgroups.blocks.MethodCall method_call)
          Replicates changes across to other nodes in the cluster.
 void _setState(byte[] new_state, Fqn targetRoot, java.lang.ClassLoader cl)
          Set the portion of the cache rooted in targetRoot to match the given state.
protected  void acquireLocksForStateTransfer(DataNode root, java.lang.Object lockOwner, long timeout, boolean lockChildren, boolean force)
          Acquires locks on a root node for an owner for state transfer.
 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)
          Adds a tree cache listener.
 void addUndoOperation(GlobalTransaction gtx, org.jgroups.blocks.MethodCall undo_op)
          Adds an undo operatoin to the transaction table.
 void block()
          Blocks sending and receiving of messages until viewAccepted() is called.
 java.util.List callRemoteMethods(java.util.List 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.List 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.List 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.reflect.Method method, java.lang.Object[] args, boolean synchronous, boolean exclude_self, long timeout)
           
 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)
          Throws UnsupportedOperationException.
protected  void createEvictionPolicy()
           
 void createService()
          Lifecycle method.
protected  DataNode createSubtreeRootNode(Fqn subtree)
          Creates a subtree in the local tree.
 void destroyService()
          Unregisters the interceptor MBeans.
protected  boolean determineCoordinator()
          Returns true if this TreeCache is the coordinator.
 java.lang.String dumpTransactionTable()
          Returns the contents of the TransactionTable as a string.
 void evict(Fqn fqn)
          Called by eviction policy provider.
 boolean exists(Fqn fqn)
          Checks whether a given node exists in current in-memory state of 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 current in-memory state of the tree.
 boolean exists(java.lang.String fqn, java.lang.Object key)
           
 void fetchState(long timeout)
          Fetches 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)
          Returns a DataNode corresponding to the fully qualified name or null if does not exist.
 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 apply 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.
 BuddyManager getBuddyManager()
          Retrieves the Buddy Manager configured.
 org.w3c.dom.Element getBuddyReplicationConfig()
          Retrieves the buddy replication cofiguration element
 CacheLoader getCacheLoader()
          Returns the underlying cache loader in use.
 boolean getCacheLoaderAsynchronous()
          Deprecated.  
 java.lang.String getCacheLoaderClass()
          Deprecated.  
 java.util.Properties getCacheLoaderConfig()
          Returns the properties in the cache loader configuration.
 org.w3c.dom.Element getCacheLoaderConfiguration()
          Returns the cache loader configuration element.
 boolean getCacheLoaderFetchPersistentState()
          Deprecated.  
 boolean getCacheLoaderFetchTransientState()
          Deprecated.  
 CacheLoaderManager getCacheLoaderManager()
          Returns the CacheLoaderManager.
 boolean getCacheLoaderPassivation()
          Deprecated.  
 java.lang.String getCacheLoaderPreload()
          Deprecated.  
 boolean getCacheLoaderShared()
          Deprecated.  
 java.lang.String getCacheMode()
          Returns the current caching mode.
 int getCacheModeInternal()
          Returns the internal caching mode as an integer.
 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 apply 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()
          Returns the name of the replication cluster group.
 java.lang.String getClusterProperties()
          Returns the cluster properties as a String.
 org.jgroups.Address getCoordinator()
          Returns the address of the coordinator or null if there is no coordinator.
 GlobalTransaction getCurrentTransaction()
          Returns the transaction associated with the current thread.
 GlobalTransaction getCurrentTransaction(boolean createIfNotExists)
          Returns the transaction associated with the thread; optionally creating it if is does not exist.
 GlobalTransaction getCurrentTransaction(javax.transaction.Transaction tx)
          Returns the global transaction for this local transaction.
 GlobalTransaction getCurrentTransaction(javax.transaction.Transaction tx, boolean createIfNotExists)
          Returns the global transaction for this local transaction.
 boolean getDeadlockDetection()
          Deprecated.  
protected  java.lang.String getDefaultProperties()
          Returns the default JGroup properties.
 java.lang.String getEvictionInterceptorClass()
           
 java.lang.String getEvictionPolicyClass()
          Returns the name of the cache eviction policy (must be an implementation of EvictionPolicy)
 org.w3c.dom.Element getEvictionPolicyConfig()
          Returns the eviction policy configuration element.
 RegionManager getEvictionRegionManager()
          Returns the eviction region manager for this TreeCache.
 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 getFetchPersistentState()
          Gets whether persistent state should be included in any state transfer.
 boolean getFetchStateOnStartup()
          Returns whether or not on startup the initial state will be acquired from existing members.
 long getInitialStateRetrievalTimeout()
          Returns the max time to wait until the initial state is retrieved.
 TreeCache getInstance()
          Returns this.
 java.lang.String getInterceptorChain()
          Returns the interceptor chain as a debug string.
 java.util.List getInterceptors()
          Returns the list of interceptors.
 java.util.Set getInternalFqns()
          Returns a Set of Fqns of the topmost node of internal regions that should not included in standard state transfers.
 InvocationContext getInvocationContext()
          Retrieves the thread-local InvocationContext.
 java.lang.String getIsolationLevel()
          Returns the transaction isolation level.
 IsolationLevel getIsolationLevelClass()
           
 java.util.Set getKeys(Fqn fqn)
          Returns a set of attribute keys for the Fqn.
 java.util.Set getKeys(java.lang.String fqn)
          Returns a set of attribute keys for the Fqn.
 java.lang.Object getLocalAddress()
          Returns the local channel address.
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()
          Returns the lock table.
 VersionAwareMarshaller getMarshaller()
           
 java.util.Vector getMembers()
          Returns the members as a Vector.
 org.jgroups.MessageListener getMessageListener()
          Returns the MessageListener in use.
 java.lang.String getMultiplexerService()
          Retrieves the JGroups multiplexer service name if defined.
 java.lang.String getMultiplexerStack()
          Retrieves the JGroups multiplexer stack name if defined.
 java.lang.String getNodeLockingScheme()
          Returns the node locking scheme as a string.
 int getNumberOfAttributes()
          Returns an approximation of the total number of attributes in the tree.
 int getNumberOfAttributes(Fqn fqn)
          Returns an approximation of the total number of attributes in this sub tree.
 int getNumberOfLocksHeld()
          Returns 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.
 org.w3c.dom.Element getPojoCacheConfig()
           
 RegionManager getRegionManager()
          Returns the region manager for this TreeCache.
 java.lang.String getReplicationVersion()
          Returns the replication version.
 short getReplicationVersionShort()
          Returns the replication version as a short.
 ReplicationQueue getReplQueue()
          Returns the replication queue.
 long getReplQueueInterval()
          Returns the replication queue interval.
 int getReplQueueMaxElements()
          Returns the replication queue max elements size.
 DataNode getRoot()
          Used internally by interceptors.
 byte[] getStateBytes()
          Returns the state bytes from the message listener.
 short getStateTransferVersion()
          Deprecated.  
 boolean getSyncCommitPhase()
          Returns if sync commit phase is used.
 long getSyncReplTimeout()
          Returns the default max timeout after which synchronous replication calls return.
 boolean getSyncRollbackPhase()
          Returns if sync rollback phase is used.
 javax.transaction.TransactionManager getTransactionManager()
           
 java.lang.String getTransactionManagerLookupClass()
           
 TransactionTable getTransactionTable()
          Returns the transaction table.
 java.util.Collection getTreeCacheListeners()
          Returns a collection containing the listeners of this tree cache.
 boolean getUseInterceptorMbeans()
          Returns true if interceptor MBeans are in use.
 boolean getUseMarshalling()
          Deprecated.  
 boolean getUseRegionBasedMarshalling()
          Tests whether region based marshaling s used.
 boolean getUseReplQueue()
          Returns true if the replication queue is being used.
 java.lang.String getVersion()
          Returns the TreeCache implementation version.
 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()
          Returns true if this is the group coordinator.
 boolean isInactiveOnStartup()
          Returns 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 true if the node locking is optimistic.
 boolean isUsingEviction()
           
 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)
          Sends a notification that a node was activated.
 void notifyNodeCreated(Fqn fqn)
          Sends a notification that a node was created.
protected  void notifyNodeEvict(Fqn fqn, boolean pre)
           
protected  void notifyNodeEvicted(Fqn fqn)
           
 void notifyNodeLoaded(Fqn fqn)
          Sends a notification that a node was loaded.
protected  void notifyNodeModified(Fqn fqn)
           
protected  void notifyNodeModify(Fqn fqn, boolean pre)
           
 void notifyNodePassivate(Fqn fqn, boolean pre)
          Sends a notification that a node was passivated.
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)
          Throws UnsupportedOperationException.
 DataNode peek(Fqn fqn)
          Deprecated. This will go away.
 java.lang.Object peek(Fqn fqn, java.lang.Object key)
          Deprecated. This will go away.
 void prepare(GlobalTransaction global_tx, java.util.List modifications, org.jgroups.Address coord, boolean onePhaseCommit)
          Throws UnsupportedOperationException.
 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()
          Prints information about the contents of the nodes in the tree's current in-memory state.
 java.lang.String printLockInfo()
          Returns lock information.
 void purgeCacheLoaders()
          Purges the contents of all configured CacheLoaders
 void put(Fqn fqn, java.util.Map data)
          Sets a node's data.
 void put(Fqn fqn, java.util.Map data, Option option)
          The same as calling put(Fqn, Map) except apply 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 apply 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)
          Registers a specific classloader for a region defined by a fully qualified name.
 void releaseAllLocks(Fqn fqn)
          Releases all locks for this node and the entire node subtree.
 void releaseAllLocks(java.lang.String fqn)
          Releases all locks for this node and the entire node subtree.
protected  void releaseStateTransferLocks(DataNode root, java.lang.Object lockOwner, boolean childrenLocked)
          Releases all state transfer locks acquired.
 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 apply options for this specific method invocation.
 void remove(Fqn fqn, Option option)
          The same as calling remove(Fqn) except apply 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)
          Removes the keys and properties from a named node.
 void removeData(java.lang.String fqn)
          Removes the keys and properties from a node.
 void removeTreeCacheListener(TreeCacheListener listener)
          Removes a tree cache listener.
 void rollback(GlobalTransaction tx)
          Throws UnsupportedOperationException.
 void setBuddyReplicationConfig(org.w3c.dom.Element config)
          Sets the buddy replication configuration element
 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)
          Sets the cache loader configuration element.
 void setCacheLoaderFetchPersistentState(boolean flag)
          Deprecated.  
 void setCacheLoaderFetchTransientState(boolean flag)
          Deprecated.  
 void setCacheLoaderManager(CacheLoaderManager cacheLoaderManager)
          Sets the 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)
          Converts a list of elements to a Java Groups property string.
 void setClusterName(java.lang.String name)
          Sets the name of the replication cluster group.
 void setClusterProperties(java.lang.String cluster_props)
          Sets the cluster properties.
 void setDeadlockDetection(boolean dt)
          Deprecated.  
 void setEvictionListener(TreeCacheListener listener)
          Sets the eviction listener.
 void setEvictionPolicyClass(java.lang.String eviction_policy_class)
          Sets the classname of the eviction policy
 void setEvictionPolicyConfig(org.w3c.dom.Element config)
          Sets the eviction policy configuration element.
 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)
          Non-functional method maintained for compile time compatibility.
 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)
          Sets the initial state transfer timeout.
 void setInterceptorChain(Interceptor i)
          Used for testing only - sets the interceptor chain.
 void setInvocationContext(InvocationContext invocationContext)
          Sets the thread-local invocation context
 void setIsolationLevel(IsolationLevel level)
           
 void setIsolationLevel(java.lang.String level)
          Set the transaction isolation level.
 void setIsUsingEviction(boolean usingEviction)
           
 void setLockAcquisitionTimeout(long timeout)
          Set the max time for lock acquisition.
 void setMultiplexerService(java.lang.String serviceName)
          Sets the JGroups multiplexer service name.
 void setMultiplexerStack(java.lang.String name)
          Used with JGroups multiplexer, specifies stack to be used (e.g., fc-fast-minimalthreads) This attribute is optional; if not provided, a default multiplexer stack will be used.
protected  void setNodeLockingOptimistic(boolean b)
          Sets whether to use optimistic locking on the nodes.
 void setNodeLockingScheme(java.lang.String s)
          Sets the node locking scheme as a string.
 void setPojoCacheConfig(org.w3c.dom.Element config)
          Used for PojoCache.
 void setReplicationVersion(java.lang.String versionString)
          Sets the replication version from a string.
 void setReplQueueInterval(long interval)
          Sets the replication queue interval.
 void setReplQueueMaxElements(int max_elements)
          Sets the replication queue max elements size.
 void setStateBytes(byte[] state)
          Sets the state bytes in the message listener.
 void setStateTransferVersion(short version)
          Deprecated.  
 void setSyncCommitPhase(boolean sync_commit_phase)
          Sets if sync commit phase is used.
 void setSyncReplTimeout(long timeout)
          Sets the default maximum wait time for synchronous replication to receive all results
 void setSyncRollbackPhase(boolean sync_rollback_phase)
          Sets if sync rollback phase is used.
 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)
          Sets if interceptor MBeans are in use.
 void setUseMarshalling(boolean isTrue)
          Deprecated.  
 void setUseRegionBasedMarshalling(boolean isTrue)
          Sets whether marshalling uses scoped class loaders on a per region basis.
 void setUseReplQueue(boolean flag)
          Sets if the replication queue should be used.
 void startService()
          Lifecyle method.
 void stopService()
          Lifecycle method.
protected  int string2Mode(java.lang.String mode)
          Converts a replication, such as repl-async mode to an integer.
 void suspect(org.jgroups.Address suspected_mbr)
          Called when a member is suspected.
 java.lang.String toString()
          Returns a debug string with few details.
 java.lang.String toString(boolean details)
          Returns a debug string with optional details of contents.
 void unregisterClassLoader(java.lang.String fqn)
          Unregisteres a class loader for a 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
Default replication version, from Version.getVersionShort().


root

protected DataNode root
Root DataNode.


hasListeners

protected boolean hasListeners
True if listeners are initialized.


channel

protected org.jgroups.JChannel channel
The JGroups JChannel in use.


mux_serviceName

protected java.lang.String mux_serviceName
The JGroups multiplexer service name; null if the multiplexer isn't used


mux_stackName

protected java.lang.String mux_stackName
The JGroups multiplexer stack name, default is "fc-fast-minimalthreads"


coordinator

protected boolean coordinator
True if this TreeCache is the coordinator.


log

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


cluster_name

protected java.lang.String cluster_name
Default cluster name.


cluster_props

protected java.lang.String cluster_props
Default cluster properties.

See Also:
getClusterProperties()

members

protected final java.util.Vector members
List of cluster group members.


disp

protected org.jgroups.blocks.RpcDispatcher disp
JGroups RpcDispatcher in use.


ml

protected org.jgroups.MessageListener ml
JGroups message listener.


use_repl_queue

protected boolean use_repl_queue
True if replication is queued.


repl_queue_max_elements

protected int repl_queue_max_elements
Maximum number of replicated elements to queue.


repl_queue_interval

protected long repl_queue_interval
Replicated element queue interval.


use_interceptor_mbeans

protected boolean use_interceptor_mbeans
True if MBean interceptors are used.

See Also:
getUseInterceptorMbeans()

fetchInMemoryState

protected boolean fetchInMemoryState

usingEviction

protected boolean usingEviction

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

internalFqns

protected java.util.Set internalFqns
Set of Fqns of the topmost node of internal regions that should not included in standard state transfers.


isStateSet

protected boolean isStateSet
True if state was initialized during start-up.


setStateException

protected java.lang.Exception setStateException
An exception occuring upon fetch state.


isolationLevel

protected IsolationLevel isolationLevel
Isolation level in use, default is IsolationLevel.REPEATABLE_READ.


evictConfig_

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


evictionInterceptorClass

protected java.lang.String evictionInterceptorClass

useRegionBasedMarshalling

protected boolean useRegionBasedMarshalling
True if we use region based marshalling. Defaults to false.


marshaller_

protected VersionAwareMarshaller 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
True if there is a synchronous commit phase, otherwise asynchronous commit.


sync_rollback_phase

protected boolean sync_rollback_phase
True if there is a synchronous rollback phase, otherwise asynchronous rollback.


eviction_policy_provider

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

repl_queue

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


SEPARATOR

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

LOCAL

public static final int LOCAL
Entries in the cache are by default local and 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(org.jboss.cache.Fqn) calls to remote caches when a node is changed. evict(org.jboss.cache.Fqn) calls are asynchronous.

See Also:
Constant Field Values

INVALIDATION_SYNC

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

See Also:
Constant Field Values

UNINITIALIZED

public static final java.lang.String UNINITIALIZED
Uninitialized node key.

See Also:
Constant Field Values

nodeLockingOptimistic

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


useCreateService

protected boolean useCreateService
_createService was called.


buddyReplicationConfig

protected org.w3c.dom.Element buddyReplicationConfig
Buddy replication configuration XML element


buddyManager

protected BuddyManager buddyManager
Buddy Manager


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 cluster name, properties, and state fetch timeout.

Throws:
java.lang.Exception

TreeCache

public TreeCache()
          throws java.lang.Exception
Constructs an uninitialized TreeCache.

Throws:
java.lang.Exception

TreeCache

public TreeCache(org.jgroups.JChannel channel)
          throws java.lang.Exception
Constructs a TreeCache with an already connected channel.

Throws:
java.lang.Exception
Method Detail

getVersion

public java.lang.String getVersion()
Returns the TreeCache implementation version.

Specified by:
getVersion in interface TreeCacheMBean

getRoot

public DataNode getRoot()
Used internally by interceptors. Don't use as client, this method will go away.


getLocalAddress

public java.lang.Object getLocalAddress()
Returns the local channel address.

Specified by:
getLocalAddress in interface TreeCacheMBean

getMembers

public java.util.Vector getMembers()
Returns the members as a Vector.

Specified by:
getMembers in interface TreeCacheMBean

isCoordinator

public boolean isCoordinator()
Returns true if this is the group coordinator.

Specified by:
isCoordinator in interface TreeCacheMBean

getClusterName

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

Specified by:
getClusterName in interface TreeCacheMBean

setClusterName

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

Specified by:
setClusterName in interface TreeCacheMBean

getClusterProperties

public java.lang.String getClusterProperties()
Returns the cluster properties as a String. In the case of JGroups, returns the JGroup protocol stack specification.

Specified by:
getClusterProperties in interface TreeCacheMBean

setClusterProperties

public void setClusterProperties(java.lang.String cluster_props)
Sets the cluster properties. To use the new properties, the cache must be restarted using ServiceMBeanSupport.stop() and ServiceMBeanSupport.start().

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

getMultiplexerService

public java.lang.String getMultiplexerService()
Description copied from interface: TreeCacheMBean
Retrieves the JGroups multiplexer service name if defined.

Specified by:
getMultiplexerService in interface TreeCacheMBean
Returns:
the multiplexer service name

setMultiplexerService

public void setMultiplexerService(java.lang.String serviceName)
Description copied from interface: TreeCacheMBean
Sets the JGroups multiplexer service name. This attribute is optional; if not provided, a JGroups JChannel will be used

Specified by:
setMultiplexerService in interface TreeCacheMBean
Parameters:
serviceName - the multiplexer service name

getMultiplexerStack

public java.lang.String getMultiplexerStack()
Description copied from interface: TreeCacheMBean
Retrieves the JGroups multiplexer stack name if defined.

Specified by:
getMultiplexerStack in interface TreeCacheMBean
Returns:
the multiplexer stack name

setMultiplexerStack

public void setMultiplexerStack(java.lang.String name)
Description copied from interface: TreeCacheMBean
Used with JGroups multiplexer, specifies stack to be used (e.g., fc-fast-minimalthreads) This attribute is optional; if not provided, a default multiplexer stack will be used.

Specified by:
setMultiplexerStack in interface TreeCacheMBean
Parameters:
name - the name of the multiplexer stack

getTransactionTable

public TransactionTable getTransactionTable()
Returns the transaction table.


getLockTable

public java.util.Map getLockTable()
Returns the lock table.


dumpTransactionTable

public java.lang.String dumpTransactionTable()
Returns the contents of the TransactionTable as a string.

Specified by:
dumpTransactionTable in interface TreeCacheMBean

getDeadlockDetection

public boolean getDeadlockDetection()
Deprecated. 

Returns false.

Specified by:
getDeadlockDetection in interface TreeCacheMBean

setDeadlockDetection

public void setDeadlockDetection(boolean dt)
Deprecated. 

Does nothing.

Specified by:
setDeadlockDetection in interface TreeCacheMBean

getInterceptorChain

public java.lang.String getInterceptorChain()
Returns the interceptor chain as a debug string. Returns <empty> if not initialized.

Specified by:
getInterceptorChain in interface TreeCacheMBean

setInterceptorChain

public void setInterceptorChain(Interceptor i)
Used for testing only - sets the interceptor chain.


getInterceptors

public java.util.List getInterceptors()
Returns the list of interceptors.

Specified by:
getInterceptors in interface TreeCacheMBean

getCacheLoaderConfiguration

public org.w3c.dom.Element getCacheLoaderConfiguration()
Returns the cache loader configuration element.

Specified by:
getCacheLoaderConfiguration in interface TreeCacheMBean

setCacheLoaderConfiguration

public void setCacheLoaderConfiguration(org.w3c.dom.Element cache_loader_config)
Sets the cache loader configuration element.

Specified by:
setCacheLoaderConfiguration in interface TreeCacheMBean

getCacheLoader

public CacheLoader getCacheLoader()
Returns the underlying cache loader in use.

Specified by:
getCacheLoader in interface TreeCacheMBean

setPojoCacheConfig

public void setPojoCacheConfig(org.w3c.dom.Element config)
                        throws CacheException
Used for PojoCache. No-op here.

Specified by:
setPojoCacheConfig in interface TreeCacheMBean
Parameters:
config -
Throws:
CacheException

getPojoCacheConfig

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

getMessageListener

public org.jgroups.MessageListener getMessageListener()
Returns the MessageListener in use.


isInactiveOnStartup

public boolean isInactiveOnStartup()
Returns 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()
Returns if sync commit phase is used.

Specified by:
getSyncCommitPhase in interface TreeCacheMBean

setSyncCommitPhase

public void setSyncCommitPhase(boolean sync_commit_phase)
Sets if sync commit phase is used.

Specified by:
setSyncCommitPhase in interface TreeCacheMBean

getSyncRollbackPhase

public boolean getSyncRollbackPhase()
Returns if sync rollback phase is used.

Specified by:
getSyncRollbackPhase in interface TreeCacheMBean

setSyncRollbackPhase

public void setSyncRollbackPhase(boolean sync_rollback_phase)
Sets if sync rollback phase is used.

Specified by:
setSyncRollbackPhase in interface TreeCacheMBean

setEvictionPolicyConfig

public void setEvictionPolicyConfig(org.w3c.dom.Element config)
Sets the eviction policy configuration element.

Specified by:
setEvictionPolicyConfig in interface TreeCacheMBean

getEvictionPolicyConfig

public org.w3c.dom.Element getEvictionPolicyConfig()
Returns the eviction policy configuration element.


getEvictionInterceptorClass

public java.lang.String getEvictionInterceptorClass()

isUsingEviction

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

setIsUsingEviction

public void setIsUsingEviction(boolean usingEviction)

setClusterConfig

public void setClusterConfig(org.w3c.dom.Element config)
Converts a list of elements to a Java Groups property string.

Specified by:
setClusterConfig in interface TreeCacheMBean

getInitialStateRetrievalTimeout

public long getInitialStateRetrievalTimeout()
Returns 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 not be initialized.

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

setInitialStateRetrievalTimeout

public void setInitialStateRetrievalTimeout(long timeout)
Sets the initial state transfer timeout. see #getInitialStateRetrievalTimeout()

Specified by:
setInitialStateRetrievalTimeout in interface TreeCacheMBean

getCacheMode

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

getCacheModeInternal

public int getCacheModeInternal()
Returns the internal caching mode as an integer.


setNodeLockingScheme

public void setNodeLockingScheme(java.lang.String s)
Sets the node locking scheme as a string. If the scheme is OPTIMISTIC, uses optimistic locking.

Specified by:
setNodeLockingScheme in interface TreeCacheMBean

getNodeLockingScheme

public java.lang.String getNodeLockingScheme()
Returns the node locking scheme as a string. Either OPTIMISTIC or PESSIMISTIC.

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 true if the node locking is optimistic.


setCacheMode

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

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()
Returns true if the replication queue is being used.

Specified by:
getUseReplQueue in interface TreeCacheMBean

setUseReplQueue

public void setUseReplQueue(boolean flag)
Sets if the replication queue should be used. If so, it is started.

Specified by:
setUseReplQueue in interface TreeCacheMBean

getReplQueueInterval

public long getReplQueueInterval()
Returns the replication queue interval.

Specified by:
getReplQueueInterval in interface TreeCacheMBean

setReplQueueInterval

public void setReplQueueInterval(long interval)
Sets the replication queue interval.

Specified by:
setReplQueueInterval in interface TreeCacheMBean

getReplQueueMaxElements

public int getReplQueueMaxElements()
Returns the replication queue max elements size.

Specified by:
getReplQueueMaxElements in interface TreeCacheMBean

setReplQueueMaxElements

public void setReplQueueMaxElements(int max_elements)
Sets the replication queue max elements size.

Specified by:
setReplQueueMaxElements in interface TreeCacheMBean

getReplQueue

public ReplicationQueue getReplQueue()
Returns the replication queue.


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, buddy replication is not configured 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
Non-functional method maintained for compile time compatibility.

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

getFetchPersistentState

public boolean getFetchPersistentState()
Gets whether persistent state should be included in any state transfer.

Returns:
true if there is a cache loader that has its FetchPersistentState property set to true

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()
Returns true if interceptor MBeans are in use.

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

setUseInterceptorMbeans

public void setUseInterceptorMbeans(boolean useMbeans)
Sets if interceptor MBeans are in use.


getInstance

public TreeCache getInstance()
Returns this.

Specified by:
getInstance in interface TreeCacheMBean

fetchState

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

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

setEvictionListener

public void setEvictionListener(TreeCacheListener listener)
Sets the eviction listener.


addTreeCacheListener

public void addTreeCacheListener(TreeCacheListener listener)
Adds a tree cache listener.

Specified by:
addTreeCacheListener in interface TreeCacheMBean

removeTreeCacheListener

public void removeTreeCacheListener(TreeCacheListener listener)
Removes a tree cache listener.

Specified by:
removeTreeCacheListener in interface TreeCacheMBean

getTreeCacheListeners

public java.util.Collection getTreeCacheListeners()
Returns a collection containing the listeners of 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()
Unregisters the interceptor MBeans.

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

setBuddyReplicationConfig

public void setBuddyReplicationConfig(org.w3c.dom.Element config)
Sets the buddy replication configuration element

Specified by:
setBuddyReplicationConfig in interface TreeCacheMBean
Parameters:
config -

getBuddyReplicationConfig

public org.w3c.dom.Element getBuddyReplicationConfig()
Retrieves the buddy replication cofiguration element

Specified by:
getBuddyReplicationConfig in interface TreeCacheMBean
Returns:
config

getBuddyManager

public BuddyManager getBuddyManager()
Retrieves the Buddy Manager configured.

Returns:
null if buddy replication is not enabled.

getInternalFqns

public java.util.Set getInternalFqns()
Returns a Set of Fqns of the topmost node of internal regions that should not included in standard state transfers. Will include BuddyManager.BUDDY_BACKUP_SUBTREE if buddy replication is enabled.

Returns:
an unmodifiable Set. Will not return null.

createEvictionPolicy

protected void createEvictionPolicy()

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)
Deprecated. 

Sets if the TreeCache will use marshalling.

Will ALWAYS use marshalling now. This is now synonymous with setRegionBasedMarshalling

Specified by:
setUseMarshalling in interface TreeCacheMBean
See Also:
setUseRegionBasedMarshalling(boolean)

getUseMarshalling

public boolean getUseMarshalling()
Deprecated. 

Returns true if the TreeCache will use marshalling.

Will ALWAYS use marshalling now. This is now synonymous with setRegionBasedMarshalling

Specified by:
getUseMarshalling in interface TreeCacheMBean
See Also:
getUseRegionBasedMarshalling()

setUseRegionBasedMarshalling

public void setUseRegionBasedMarshalling(boolean isTrue)
Sets whether marshalling uses scoped class loaders on a per region basis.

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

Specified by:
setUseRegionBasedMarshalling in interface TreeCacheMBean
Parameters:
isTrue -

getUseRegionBasedMarshalling

public boolean getUseRegionBasedMarshalling()
Tests whether region based marshaling s used.

Specified by:
getUseRegionBasedMarshalling in interface TreeCacheMBean
Returns:
true if region based marshalling is used.

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()
Returns true if this TreeCache is the coordinator.


getCoordinator

public org.jgroups.Address getCoordinator()
Returns the address of the coordinator or null if there is no coordinator.


getStateBytes

public byte[] getStateBytes()
Returns the state bytes from the message listener.


setStateBytes

public void setStateBytes(byte[] state)
Sets the state bytes in the message listener.


registerClassLoader

public void registerClassLoader(java.lang.String fqn,
                                java.lang.ClassLoader cl)
                         throws RegionNameConflictException
Registers a specific classloader for a region defined by a fully qualified name. A instance of TreeCacheMarshaller is used for marshalling.

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 existing registering for the fqn.
java.lang.IllegalStateException - if marshalling is not being used
See Also:
getUseMarshalling(), getMarshaller()

unregisterClassLoader

public void unregisterClassLoader(java.lang.String fqn)
                           throws RegionNotFoundException
Unregisteres a class loader for a region.

Specified by:
unregisterClassLoader in interface TreeCacheMBean
Parameters:
fqn - The fqn region.
Throws:
RegionNotFoundException - If there is a conflict in fqn specification.
java.lang.IllegalStateException - if marshalling is not being used
See Also:
getUseMarshalling()

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

_loadState

public void _loadState(Fqn subtreeRoot,
                       Fqn integrationRoot,
                       java.lang.Object[] sources,
                       java.lang.ClassLoader cl)
                throws java.lang.Exception
Requests state from each of the given source nodes in the cluster until it gets it or no node replies with a timeout exception. If state is returned, integrates it into the given DataNode. If no state is returned but a node replies with a timeout exception, the calls will be repeated with a longer timeout, until 3 attempts have been made.

Parameters:
subtreeRoot - Fqn of the topmost node in the subtree whose state should be transferred.
integrationRoot - Fqn of the node into which state should be integrated
sources - the cluster nodes to query for state
cl - the classloader to use to unmarshal the state. Can be null.
Throws:
java.lang.Exception

_loadState

public void _loadState(Fqn subtreeRoot,
                       DataNode integrationRoot,
                       java.lang.Object[] sources,
                       java.lang.ClassLoader cl)
                throws java.lang.Exception
Requests state from each of the given source nodes in the cluster until it gets it or no node replies with a timeout exception. If state is returned, integrates it into the given DataNode. If no state is returned but a node replies with a timeout exception, the calls will be repeated with a longer timeout, until 3 attempts have been made.

Parameters:
subtreeRoot - Fqn of the topmost node in the subtree whose state should be transferred.
integrationRoot - the DataNode into which state should be integrated
sources - the cluster nodes to query for state
cl - the classloader to use to unmarshal the state. Can be null.
Throws:
java.lang.Exception

createSubtreeRootNode

protected DataNode createSubtreeRootNode(Fqn subtree)
                                  throws CacheException
Creates a subtree in the local tree. Returns the DataNode created.

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
Called internally to enqueue a method call.

Parameters:
subtree - FQN of the subtree region
Throws:
java.lang.Throwable
See Also:
Region.getMethodCallQueue()

_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

_getState

public byte[] _getState(Fqn fqn,
                        boolean fetchTransientState,
                        boolean fetchPersistentState,
                        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 PojoCache. 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

_setState

public void _setState(byte[] new_state,
                      Fqn targetRoot,
                      java.lang.ClassLoader cl)
               throws java.lang.Exception
Set the portion of the cache rooted in targetRoot to match the given state. Updates the contents of targetRoot to reflect those in new_state.

NOTE: This method performs no locking of nodes; it is up to the caller to lock targetRoot before calling this method.

Parameters:
new_state - a serialized byte[][] array where element 0 is the transient state (or null) , and element 1 is the persistent state (or null)
targetRoot - fqn of the node into which the state should be integrated
cl - classloader to use to unmarshal the state, or null if the TCCL should be used
Throws:
java.lang.Exception

getReplicationVersion

public java.lang.String getReplicationVersion()
Returns the 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)
Sets the replication version from a string.

Specified by:
setReplicationVersion in interface TreeCacheMBean
Parameters:
versionString - a short identifying JBossCache release; e.g. 124 for JBossCache 1.2.4
See Also:
Version.getVersionShort()

getReplicationVersionShort

public short getReplicationVersionShort()
Returns the replication version as a short.


getStateTransferVersion

public short getStateTransferVersion()
Deprecated. 

Calls getReplicationVersionShort().

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)
Deprecated. 

Calls setReplicationVersion(java.lang.String) with the version string from Version.getVersionString(short).

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
Acquires locks on a root node for an owner for state transfer.

Throws:
java.lang.Exception

releaseStateTransferLocks

protected void releaseStateTransferLocks(DataNode root,
                                         java.lang.Object lockOwner,
                                         boolean childrenLocked)
Releases all state transfer locks acquired.

See Also:
acquireLocksForStateTransfer(org.jboss.cache.DataNode, java.lang.Object, long, boolean, boolean)

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 apply options for this specific method invocation.

Specified by:
get in interface TreeCacheMBean
Returns:
Throws:
CacheException

remove

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

Specified by:
remove in interface TreeCacheMBean
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 apply options for this specific method invocation.

Specified by:
remove in interface TreeCacheMBean
Throws:
CacheException

getChildrenNames

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

Specified by:
getChildrenNames in interface TreeCacheMBean
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 apply options for this specific method invocation.

Specified by:
put in interface TreeCacheMBean
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 apply options for this specific method invocation.

Specified by:
put in interface TreeCacheMBean
Throws:
CacheException

get

public Node get(Fqn fqn)
         throws CacheException
Returns a DataNode corresponding to the fully qualified name or null if does not exist. No guarantees wrt replication, cache loading are given if the underlying node is modified

Specified by:
get in interface TreeCacheMBean
Parameters:
fqn - name of the DataNode to retreive
Throws:
CacheException

_get

public Node _get(Fqn fqn)
          throws CacheException
Returns the raw data of the node; called externally internally.

Throws:
CacheException

_getData

public java.util.Map _getData(Fqn fqn)
Returns the raw data of the node; called externally internally. Note: This may return a Map with the key UNINITIALIZED indicating the node was not completely loaded.


getKeys

public java.util.Set getKeys(java.lang.String fqn)
                      throws CacheException
Returns a set of attribute keys for the Fqn. Returns null if the node is not found, otherwise a Set. The set is a copy of the actual keys for this node.

Specified by:
getKeys in interface TreeCacheMBean
Parameters:
fqn - name of the node
Throws:
CacheException

getKeys

public java.util.Set getKeys(Fqn fqn)
                      throws CacheException
Returns a set of attribute keys for the Fqn. Returns null if the node is not found, otherwise a Set. The set is a copy of the actual keys for this node.

Specified by:
getKeys in interface TreeCacheMBean
Parameters:
fqn - name of the node
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
Deprecated. This will go away.

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)
Deprecated. This will go away.

added so one can get nodes internally without triggering stuff


exists

public boolean exists(java.lang.String fqn)
Checks whether a given node exists in current in-memory state of the tree. Does not acquire any locks in doing so (result may be dirty read). Does not attempt to load nodes from a cache loader (may return false if a node has been evicted).

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 current in-memory state of the tree. Does not acquire any locks in doing so (result may be dirty read). Does not attempt to load nodes from a cache loader (may return false if a node has been evicted).

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
Sets a node's data. If the node does 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 will cause the replication nodes to not be synchronizing, which is fine since the value will be fetched again when get(java.lang.String) returns 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
Removes the keys and properties from a node.

Specified by:
removeData in interface TreeCacheMBean
Throws:
CacheException

removeData

public void removeData(Fqn fqn)
                throws CacheException
Removes the keys and properties from a named node.

Specified by:
removeData in interface TreeCacheMBean
Throws:
CacheException

releaseAllLocks

public void releaseAllLocks(java.lang.String fqn)
Releases all locks for this node and the entire node subtree.

Specified by:
releaseAllLocks in interface TreeCacheMBean

releaseAllLocks

public void releaseAllLocks(Fqn fqn)
Releases all locks for this node and the entire node subtree.

Specified by:
releaseAllLocks in interface TreeCacheMBean

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. Returns null of the parent node was not found, or if there are no children. The set is unmodifiable.

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
See Also:
getChildrenNames(Fqn)

getChildrenNames

public java.util.Set getChildrenNames(Fqn fqn)
                               throws CacheException
Returns all children of a given node. Returns null of the parent node was not found, or if there are no children. The set is unmodifiable.

Specified by:
getChildrenNames in interface TreeCacheMBean
Parameters:
fqn - The fully qualified name of the node
Returns:
Set an unmodifiable set of children names, Object.
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()
Returns a debug string with few details.

Specified by:
toString in interface TreeCacheMBean
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(boolean details)
Returns a debug string with optional details of contents.


printDetails

public java.lang.String printDetails()
Prints information about the contents of the nodes in the tree's current in-memory state. Does not load any previously evicted nodes from a cache loader, so evicted nodes will not be included.

Specified by:
printDetails in interface TreeCacheMBean

printLockInfo

public java.lang.String printLockInfo()
Returns lock information.

Specified by:
printLockInfo in interface TreeCacheMBean

getNumberOfLocksHeld

public int getNumberOfLocksHeld()
Returns 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)
Returns an approximation of the total number of attributes in this sub tree.

See Also:
getNumberOfAttributes()

callRemoteMethods

public java.util.List callRemoteMethods(java.util.List 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.List 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.List 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.

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.reflect.Method method,
                                        java.lang.Object[] args,
                                        boolean synchronous,
                                        boolean exclude_self,
                                        long timeout)
                                 throws java.lang.Exception
Specified by:
callRemoteMethods in interface TreeCacheMBean
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
Internal put method. 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
Internal put method. 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
Internal put method. 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
Internal put method.

Specified by:
_put in interface TreeCacheMBean
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
Internal put method.

Specified by:
_put in interface TreeCacheMBean
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
Internal put method.

Throws:
CacheException

_remove

public void _remove(GlobalTransaction tx,
                    java.lang.String fqn,
                    boolean create_undo_ops)
             throws CacheException
Internal remove method.

Specified by:
_remove in interface TreeCacheMBean
Throws:
CacheException

_remove

public void _remove(GlobalTransaction tx,
                    Fqn fqn,
                    boolean create_undo_ops)
             throws CacheException
Internal remove method.

Specified by:
_remove in interface TreeCacheMBean
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
Internal method to 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
Internal method to remove a node. Performs a remove on a node, passing in a DataVersion which is used with optimistically locked nodes. Pass in a null if optimistic locking is not used.

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
Internal method to remove a key.

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
Internal method to remove a key.

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
Internal method to remove data from a node.

Throws:
CacheException

_removeData

public void _removeData(GlobalTransaction tx,
                        Fqn fqn,
                        boolean create_undo_ops)
                 throws CacheException
Internal method to remove data from a node.

Throws:
CacheException

_removeData

public void _removeData(GlobalTransaction tx,
                        Fqn fqn,
                        boolean create_undo_ops,
                        boolean sendNodeEvent)
                 throws CacheException
Internal method to remove data from a node.

Throws:
CacheException

_removeData

public void _removeData(GlobalTransaction tx,
                        Fqn fqn,
                        boolean create_undo_ops,
                        boolean sendNodeEvent,
                        boolean eviction)
                 throws CacheException
Internal method to remove data from a node.

Throws:
CacheException

_removeData

public void _removeData(GlobalTransaction tx,
                        Fqn fqn,
                        boolean create_undo_ops,
                        boolean sendNodeEvent,
                        boolean eviction,
                        DataVersion version)
                 throws CacheException
Internal method to remove data from a node.

Throws:
CacheException

_evict

public void _evict(Fqn fqn)
            throws CacheException
Internal evict method called by eviction policy provider.

Parameters:
fqn - removes everything assoicated with this FQN
Throws:
CacheException

_evict

public void _evict(Fqn fqn,
                   DataVersion version)
            throws CacheException
Internal evict method called by eviction policy provider.

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).

Throws:
CacheException

_replicate

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

Throws:
java.lang.Throwable

_replicate

public void _replicate(java.util.List method_calls)
                throws java.lang.Throwable
Replicates a list of method calls.

Throws:
java.lang.Throwable

_clusteredGet

public java.util.List _clusteredGet(org.jgroups.blocks.MethodCall methodCall,
                                    java.lang.Boolean searchBackupSubtrees)
A 'clustered get' call, called from a remote ClusteredCacheLoader.

Returns:
a List containing 2 elements: (Boolean.TRUE or Boolean.FALSE) and a value (Object). If buddy replication is used one further element is added - an Fqn of the backup subtree in which this node may be found.

_gravitateData

public java.util.List _gravitateData(Fqn fqn,
                                     boolean searchSubtrees,
                                     boolean marshal)
                              throws CacheException
Used with buddy replication's data gravitation interceptor

Parameters:
fqn - the fqn to gravitate
searchSubtrees - should _BUDDY_BACKUP_ subtrees be searched
marshal - should the list of NodeData being gravitated be marshalled into a byte[] or returned as a List
Returns:
List with 1 or 3 elements. First element is a Boolean indicating whether data was found. If Boolean.FALSE, the list will only have one element. Otherwise, second element is the data itself, structured as a List of NodeData objects, each of which represents one Node in the subtree rooted at fqn. If param mnarshal is true, this second element will have been marshalled to a byte[], otherwise it will be the raw list. The third element represents the Fqn in the _BUDDY_BACKUP_ region that needs to be cleaned in order to remove this data once the new owner has acquired it.
Throws:
CacheException

_remoteAssignToBuddyGroup

public void _remoteAssignToBuddyGroup(BuddyGroup group,
                                      java.util.Map state)
                               throws java.lang.Exception
Performs a search. returns a 2-dim object array, 0 - callResult, 1 - actualFqn (if found in a backup subtree), null otherwise

Parameters:
m -
args -
searchBackupSubtrees -
Throws:
java.lang.Exception

_remoteRemoveFromBuddyGroup

public void _remoteRemoveFromBuddyGroup(java.lang.String groupName)

_remoteAnnounceBuddyPoolName

public void _remoteAnnounceBuddyPoolName(org.jgroups.stack.IpAddress address,
                                         java.lang.String buddyPoolName)

_dataGravitationCleanup

public void _dataGravitationCleanup(GlobalTransaction gtx,
                                    Fqn primary,
                                    Fqn backup)
                             throws java.lang.Exception
Throws:
java.lang.Exception

_releaseAllLocks

public void _releaseAllLocks(Fqn fqn)
Releases all locks for a FQN.


_print

public java.lang.String _print(Fqn fqn)
Finds and returns the org.jboss.cache.DataNode#toString() value for the Fqn. Returns null if not found or upon error.


_lock

public void _lock(Fqn fqn,
                  int lock_type,
                  boolean recursive)
           throws TimeoutException,
                  LockingException
Should not be called.

Throws:
TimeoutException
LockingException

optimisticPrepare

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


prepare

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


commit

public void commit(GlobalTransaction tx)
Throws UnsupportedOperationException.


rollback

public void rollback(GlobalTransaction tx)
Throws UnsupportedOperationException.


addUndoOperation

public void addUndoOperation(GlobalTransaction gtx,
                             org.jgroups.blocks.MethodCall undo_op)
Adds an undo operatoin to the transaction table.


getCacheLoaderManager

public CacheLoaderManager getCacheLoaderManager()
Returns the CacheLoaderManager.


setCacheLoaderManager

public void setCacheLoaderManager(CacheLoaderManager cacheLoaderManager)
Sets the 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()
Blocks 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()
Returns the transaction associated with the current thread. 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.

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

getCurrentTransaction

public GlobalTransaction getCurrentTransaction(boolean createIfNotExists)
Returns the transaction associated with the thread; optionally creating it if is does not exist.


getCurrentTransaction

public GlobalTransaction getCurrentTransaction(javax.transaction.Transaction tx)
Returns the global transaction for this local transaction.


getCurrentTransaction

public GlobalTransaction getCurrentTransaction(javax.transaction.Transaction tx,
                                               boolean createIfNotExists)
Returns the global transaction for this local transaction.

Parameters:
createIfNotExists - if true, if a global transaction is not found; one is created

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).

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()
Returns the region manager for this TreeCache.


getEvictionRegionManager

public RegionManager getEvictionRegionManager()
Returns the eviction region manager for this TreeCache.


getMarshaller

public VersionAwareMarshaller getMarshaller()

notifyNodeCreated

public void notifyNodeCreated(Fqn fqn)
Sends a notification that a node was created.


notifyNodeLoaded

public void notifyNodeLoaded(Fqn fqn)
Sends a notification that a node was loaded.


notifyNodeActivate

public void notifyNodeActivate(Fqn fqn,
                               boolean pre)
Sends a notification that a node was activated.


notifyNodePassivate

public void notifyNodePassivate(Fqn fqn,
                                boolean pre)
Sends a notification that a node was passivated.


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()
Returns the default JGroup properties. Subclasses may wish to override this method.


string2Mode

protected int string2Mode(java.lang.String mode)
Converts a replication, such as repl-async mode to an integer.


setInvocationContext

public void setInvocationContext(InvocationContext invocationContext)
Sets the thread-local invocation context

Parameters:
invocationContext - the context for the current invocation

getInvocationContext

public InvocationContext getInvocationContext()
Retrieves the thread-local InvocationContext.

Returns:
the context for the current invocation

setCacheLoaderClass

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

Sets the cache loader class name.

Specified by:
setCacheLoaderClass in interface TreeCacheMBean
See Also:
setCacheLoaderConfiguration(org.w3c.dom.Element)

setCacheLoaderConfig

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

Sets the cache loader configuration.

Specified by:
setCacheLoaderConfig in interface TreeCacheMBean
See Also:
setCacheLoaderConfiguration(org.w3c.dom.Element)

setCacheLoaderShared

public void setCacheLoaderShared(boolean shared)
Deprecated. 

Sets the cache loader shared state.

Specified by:
setCacheLoaderShared in interface TreeCacheMBean
See Also:
setCacheLoaderConfiguration(org.w3c.dom.Element)

setCacheLoaderPassivation

public void setCacheLoaderPassivation(boolean passivate)
Deprecated. 

Specified by:
setCacheLoaderPassivation in interface TreeCacheMBean
See Also:
setCacheLoaderConfiguration(org.w3c.dom.Element)

setCacheLoaderPreload

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

Specified by:
setCacheLoaderPreload in interface TreeCacheMBean
See Also:
setCacheLoaderConfiguration(org.w3c.dom.Element)

setCacheLoaderAsynchronous

public void setCacheLoaderAsynchronous(boolean b)
Deprecated. 

Specified by:
setCacheLoaderAsynchronous in interface TreeCacheMBean
See Also:
setCacheLoaderConfiguration(org.w3c.dom.Element)

setCacheLoaderFetchPersistentState

public void setCacheLoaderFetchPersistentState(boolean flag)
Deprecated. 

Specified by:
setCacheLoaderFetchPersistentState in interface TreeCacheMBean
See Also:
setCacheLoaderConfiguration(org.w3c.dom.Element)

setCacheLoaderFetchTransientState

public void setCacheLoaderFetchTransientState(boolean flag)
Deprecated. 

Specified by:
setCacheLoaderFetchTransientState in interface TreeCacheMBean
See Also:
setCacheLoaderConfiguration(org.w3c.dom.Element)

setCacheLoader

public void setCacheLoader(CacheLoader loader)
Deprecated. 

Sets the CacheLoader to use. Provided for backwards compatibility.

Specified by:
setCacheLoader in interface TreeCacheMBean
Parameters:
loader -

getCacheLoaderClass

public java.lang.String getCacheLoaderClass()
Deprecated. 

Returns the cache loader class name. Provided for backward compatibility. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderClass in interface TreeCacheMBean

getCacheLoaderShared

public boolean getCacheLoaderShared()
Deprecated. 

Returns false always. Provided for backward compatibility. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderShared in interface TreeCacheMBean

getCacheLoaderPassivation

public boolean getCacheLoaderPassivation()
Deprecated. 

Returns true if passivation is on. Provided for backward compatibility. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderPassivation in interface TreeCacheMBean

getCacheLoaderAsynchronous

public boolean getCacheLoaderAsynchronous()
Deprecated. 

Returns true if the cache loader is asynchronous. Provided for backward compatibility. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderAsynchronous in interface TreeCacheMBean

getCacheLoaderPreload

public java.lang.String getCacheLoaderPreload()
Deprecated. 

Provided for backward compatibility. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderPreload in interface TreeCacheMBean

getCacheLoaderFetchPersistentState

public boolean getCacheLoaderFetchPersistentState()
Deprecated. 

Provided for backward compatibility. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderFetchPersistentState in interface TreeCacheMBean

getCacheLoaderFetchTransientState

public boolean getCacheLoaderFetchTransientState()
Deprecated. 

Provided for backward compatibility. Use getCacheLoaderConfiguration() instead.

Specified by:
getCacheLoaderFetchTransientState in interface TreeCacheMBean

getCacheLoaderConfig

public java.util.Properties getCacheLoaderConfig()
Returns the properties in the cache loader configuration.

Specified by:
getCacheLoaderConfig in interface TreeCacheMBean

purgeCacheLoaders

public void purgeCacheLoaders()
                       throws java.lang.Exception
Purges the contents of all configured CacheLoaders

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


Copyright 1998-2005 JBoss Inc . All Rights Reserved.