org.jboss.cache
Class TreeCache

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.cache.TreeCache
All Implemented Interfaces:
java.lang.Cloneable, MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src)
Direct Known Subclasses:
TreeCacheAop (src)

public class TreeCache
extends ServiceMBeanSupport (src)
implements java.lang.Cloneable

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


Field Summary
static java.lang.reflect.Method addChildMethodLocal
           
protected  CacheLoader (src) cache_loader
          A reference to the CacheLoader.
protected  java.lang.String cache_loader_class
          The fully qualified name of the CacheLoader (has to implement the CacheLoader interface)
protected  java.util.Properties cache_loader_config
          The properties from which to configure the CacheLoader
protected  boolean cache_loader_fetch_persistent_state
          Fetches the entire persistent state from the underlying CacheLoader.
protected  boolean cache_loader_fetch_transient_state
          Fetches the transient state.
protected  java.util.List cache_loader_preload
          List of nodes to preload (if cache loader is enabled)
protected  boolean cache_loader_shared
          Are the CacheLoaders sharing the same resource or not ?
protected  int cache_mode
           
protected  JChannel channel
           
protected  java.lang.String cluster_name
           
protected  java.lang.String cluster_props
           
static java.lang.reflect.Method commitMethod
           
protected  boolean coordinator
          Am I the coordinator ?
protected  boolean deadlockDetection
           
protected  RpcDispatcher disp
           
protected  org.w3c.dom.Element evictConfig_
          Eviction policy configuration in xml Element
protected  java.lang.String eviction_policy_class
           
protected  TreeCacheListener (src) eviction_policy_provider
           
static java.lang.reflect.Method evictNodeMethodLocal
           
protected  boolean fetch_state_on_startup
           
static java.lang.reflect.Method getChildrenNamesMethodLocal
           
static java.lang.reflect.Method getKeysMethodLocal
           
static java.lang.reflect.Method getKeyValueMethodLocal
           
static java.lang.reflect.Method getNodeMethodLocal
           
protected  Interceptor (src) interceptor_chain
          invokeMethod(MethodCall) will dispatch to this chain of interceptors.
protected  IsolationLevel (src) isolationLevel
           
protected  boolean isStateSet
           
protected  java.util.Vector listeners
           
static int LOCAL
          Entries in the cache are by default local; ie.
protected  long lock_acquisition_timeout
           
static java.lang.reflect.Method lockMethodLocal
           
protected  java.util.Vector members
           
protected  MessageListener ml
           
static java.lang.reflect.Method prepareMethod
           
static java.lang.reflect.Method printMethodLocal
           
static java.lang.reflect.Method putDataEraseMethodLocal
           
static java.lang.reflect.Method putDataMethodLocal
           
static java.lang.reflect.Method putFailFastKeyValueMethodLocal
           
static java.lang.reflect.Method putKeyValMethodLocal
           
static java.lang.reflect.Method releaseAllLocksMethodLocal
           
static java.lang.reflect.Method removeDataMethodLocal
           
static java.lang.reflect.Method removeKeyMethodLocal
           
static java.lang.reflect.Method removeNodeMethodLocal
           
static int REPL_ASYNC
          Entries in the cache are by default replicated (asynchronously)
protected  ReplicationQueue (src) repl_queue
          Queue used to replicate updates when mode is repl-async
protected  long repl_queue_interval
           
protected  int repl_queue_max_elements
           
static int REPL_SYNC
          Entries in the cache are by default replicated (synchronously)
static java.lang.reflect.Method replicateAllMethod
           
static java.lang.reflect.Method replicateMethod
           
protected  Replicatable (src) replication_handler
          Interceptor which handles invocations of _replicate(MethodCall).
static java.lang.reflect.Method rollbackMethod
           
protected  Node (src) root
           
static java.lang.String SEPARATOR
           
protected  long state_fetch_timeout
           
protected  boolean sync_commit_phase
          synchronous or asynchrous commit phase ?
protected  long sync_repl_timeout
           
protected  boolean sync_rollback_phase
          synchronous or asynchrous rollback phase ?
protected  TransactionManager (src) tm
          Used to get the Transaction associated with the current thread
protected  TransactionManagerLookup (src) tm_lookup
          Method to acquire a TransactionManager.
protected  java.lang.String tm_lookup_class
          Class of the implementation of TransactionManagerLookup
static java.lang.String UNINITIALIZED
           
protected  boolean use_repl_queue
           
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
TreeCache()
           
TreeCache(JChannel channel)
          Expects an already connected channel.
TreeCache(java.lang.String cluster_name, java.lang.String props, long state_fetch_timeout)
          Creates a channel with the given properties.
 
Method Summary
 void _addChild(GlobalTransaction (src)  tx, Fqn (src)  parent_fqn, java.lang.Object child_name, Node (src)  old_node)
          Compensating method to _remove(GlobalTransaction,Fqn,boolean).
 void _evict(Fqn (src)  fqn)
          Called by eviction policy provider.
 Node (src) _get(Fqn (src)  fqn)
           
 java.lang.Object _get(Fqn (src)  fqn, java.lang.Object key, boolean sendNodeEvent)
           
 java.util.Set _getChildrenNames(Fqn (src)  fqn)
           
 java.util.Set _getKeys(Fqn (src)  fqn)
           
 void _lock(Fqn (src)  fqn, int lock_type, boolean recursive)
           
 java.lang.String _print(Fqn (src)  fqn)
           
 void _put(GlobalTransaction (src)  tx, Fqn (src)  fqn, java.util.Map data, boolean create_undo_ops)
          Does the real work.
 void _put(GlobalTransaction (src)  tx, Fqn (src)  fqn, java.util.Map data, boolean create_undo_ops, boolean erase_contents)
          Does the real work.
 java.lang.Object _put(GlobalTransaction (src)  tx, Fqn (src)  fqn, java.lang.Object key, java.lang.Object value, boolean create_undo_ops)
           
 java.lang.Object _put(GlobalTransaction (src)  tx, Fqn (src)  fqn, java.lang.Object key, java.lang.Object value, boolean create_undo_ops, long timeout)
           
 void _put(GlobalTransaction (src)  tx, java.lang.String fqn, java.util.Map data, boolean create_undo_ops)
          Does the real work.
 java.lang.Object _put(GlobalTransaction (src)  tx, java.lang.String fqn, java.lang.Object key, java.lang.Object value, boolean create_undo_ops)
           
 void _releaseAllLocks(Fqn (src)  fqn)
           
 void _remove(GlobalTransaction (src)  tx, Fqn (src)  fqn, boolean create_undo_ops)
           
 void _remove(GlobalTransaction (src)  tx, Fqn (src)  fqn, boolean create_undo_ops, boolean sendNodeEvent)
           
 void _remove(GlobalTransaction (src)  tx, Fqn (src)  fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction)
          Remove a node
 java.lang.Object _remove(GlobalTransaction (src)  tx, Fqn (src)  fqn, java.lang.Object key, boolean create_undo_ops)
           
 java.lang.Object _remove(GlobalTransaction (src)  tx, Fqn (src)  fqn, java.lang.Object key, boolean create_undo_ops, boolean sendNodeEvent)
           
 void _remove(GlobalTransaction (src)  tx, java.lang.String fqn, boolean create_undo_ops)
           
 java.lang.Object _remove(GlobalTransaction (src)  tx, java.lang.String fqn, java.lang.Object key, boolean create_undo_ops)
           
 void _removeData(GlobalTransaction (src)  tx, Fqn (src)  fqn, boolean create_undo_ops)
           
 void _removeData(GlobalTransaction (src)  tx, Fqn (src)  fqn, boolean create_undo_ops, boolean sendNodeEvent)
           
 void _removeData(GlobalTransaction (src)  tx, Fqn (src)  fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction)
           
 void _removeData(GlobalTransaction (src)  tx, java.lang.String fqn, boolean create_undo_ops)
           
 java.lang.Object _replicate(MethodCall method_call)
          Invoked by the ReplicationInterceptor of other nodes in the cluster, to replicate their changes across the cluster.
 void addNode(GlobalTransaction (src)  gtx, Fqn (src)  node)
           
 void addTreeCacheListener(TreeCacheListener (src)  listener)
           
 void block()
          Block sending and receiving of messages until viewAccepted() is called
protected  void cacheLoaderPreload()
           
 java.util.List callRemoteMethods(java.util.Vector mbrs, MethodCall method_call, boolean synchronous, boolean exclude_self, long timeout)
           
 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)
           
 void commit(GlobalTransaction (src)  tx)
           
protected  void createCacheLoader()
          Creates an instance of a CacheLoader if and only if The CacheLoader has not yet been created cache_loader_class is set The CacheLoader is shared and we are not the coordinator (only the coordinator is supposed to have a CacheLoader)
protected  void createInterceptorChain()
          Assembles the interceptor stack.
 void createService()
          Sub-classes should override this method to provide custum 'create' logic.
 void destroyService()
          Sub-classes should override this method to provide custum 'destroy' logic.
protected  boolean determineCoordinator()
           
 java.lang.String dumpTransactionTable()
          Dumps the contents of the TransactionTable
 void evict(Fqn (src)  fqn)
          Called by eviction policy provider.
 boolean exists(Fqn (src)  fqn)
          Checks whether a given node exists in the tree.
 boolean exists(Fqn (src)  fqn, java.lang.Object key)
          Checks whether a given key exists in the given node.
 boolean exists(java.lang.String fqn)
          Checks whether a given node exists in the tree
 boolean exists(java.lang.String fqn, java.lang.Object key)
           
 void fetchState(long timeout)
          Fetch the group state from the current coordinator.
protected  void fetchStateOnStartup()
           
 Node (src) get(Fqn (src)  fqn)
           
 java.lang.Object get(Fqn (src)  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 (src)  fqn, java.lang.Object key, boolean sendNodeEvent)
           
 Node (src) get(java.lang.String fqn)
           
 java.lang.Object get(java.lang.String fqn, java.lang.Object key)
          Finds a node given its name and returns the value associated with a given key in its data map.
 CacheLoader (src) getCacheLoader()
           
 java.lang.String getCacheLoaderClass()
           
 java.util.Properties getCacheLoaderConfig()
           
 boolean getCacheLoaderFetchPersistentState()
           
 boolean getCacheLoaderFetchTransientState()
           
 java.lang.String getCacheLoaderPreload()
           
 boolean getCacheLoaderShared()
           
 java.lang.String getCacheMode()
          Returns the current caching mode.
 int getCacheModeInternal()
           
 java.util.Set getChildrenNames(Fqn (src)  fqn)
          Returns all children of a given node
 java.util.Set getChildrenNames(java.lang.String fqn)
          Returns all children of a given node
 java.lang.String getClusterName()
          Get the name of the replication group
 java.lang.String getClusterProperties()
          Get the cluster properties (e.g.
 Address getCoordinator()
           
 GlobalTransaction (src) getCurrentTransaction()
          Get the transaction associated with the current thread and maps it onto a GlobalTransaction (src) .
 GlobalTransaction (src) getCurrentTransaction(Transaction (src)  tx)
           
 boolean getDeadlockDetection()
           
protected  java.lang.String getDefaultProperties()
           
 java.lang.String getEvictionPolicyClass()
          Returns the name of the cache eviction policy (must be an implementation of EvictionPolicy)
 org.w3c.dom.Element getEvictionPolicyConfig()
           
 int getEvictionThreadWakeupIntervalSeconds()
          Obtain eviction thread (if any) wake up interval in seconds
 boolean getFetchStateOnStartup()
           
 long getInitialStateRetrievalTimeout()
          Get the max time to wait until the initial state is retrieved.
 TreeCache (src) getInstance()
           
 java.lang.String getInterceptorChain()
           
 java.util.List getInterceptors()
           
 java.lang.String getIsolationLevel()
          Returns the transaction isolation level.
 IsolationLevel (src) getIsolationLevelClass()
           
 java.util.Set getKeys(Fqn (src)  fqn)
           
 java.util.Set getKeys(java.lang.String fqn)
           
 java.lang.Object getLocalAddress()
           
protected  Transaction (src) getLocalTransaction()
          Returns the transaction associated with the current thread.
 long getLockAcquisitionTimeout()
          Default max time to wait for a lock.
 java.util.HashMap getLockTable()
           
 java.util.Vector getMembers()
           
 MessageListener getMessageListener()
           
 int getNumberOfAttributes()
          Returns an approximation of the total number of attributes in the tree.
 int getNumberOfLocksHeld()
          Gets the number of read or write locks held across the entire tree
 int getNumberOfNodes()
          Returns an approximation of the total number of nodes in the tree.
 Replicatable (src) getReplicationHandler()
           
 ReplicationQueue (src) getReplQueue()
           
 long getReplQueueInterval()
           
 int getReplQueueMaxElements()
           
 Node (src) getRoot()
          Used by interceptors.
 byte[] getStateBytes()
           
 boolean getSyncCommitPhase()
           
 long getSyncReplTimeout()
          Returns the default max timeout after which synchronous replication calls return.
 boolean getSyncRollbackPhase()
           
 TransactionManager (src) getTransactionManager()
           
 java.lang.String getTransactionManagerLookupClass()
           
 TransactionTable (src) getTransactionTable()
           
 boolean getUseReplQueue()
           
 boolean hasChild(Fqn (src)  fqn)
           
protected  java.lang.Object invokeMethod(MethodCall m)
          Invokes a method against this object.
 boolean isCoordinator()
           
static boolean isCrudMethod(java.lang.reflect.Method m)
           
 void load(java.lang.String fqn)
          Loads the indicated Fqn, plus all parents recursively from the CacheLoader.
protected  void notifyAllNodesCreated(Node (src)  curr)
          Generates NodeAdded notifications for all nodes of the tree.
protected  void notifyCacheStarted()
           
protected  void notifyCacheStopped()
           
 void notifyNodeCreated(Fqn (src)  fqn)
           
protected  void notifyNodeEvicted(Fqn (src)  fqn)
           
 void notifyNodeLoaded(Fqn (src)  fqn)
           
protected  void notifyNodeModified(Fqn (src)  fqn)
           
protected  void notifyNodeRemoved(Fqn (src)  fqn)
           
protected  void notifyNodeVisisted(Fqn (src)  fqn)
           
protected  void notifyViewChange(View v)
           
 java.lang.Object peek(Fqn (src)  fqn, java.lang.Object key)
          Like get() method but without triggering a node visit event.
 void prepare(GlobalTransaction (src)  global_tx, java.util.List modifications, Address coord, boolean commit)
           
 java.lang.String print(Fqn (src)  fqn)
          Prints a representation of the node defined by fqn.
 java.lang.String print(java.lang.String fqn)
          Prints a representation of the node defined by fqn.
 java.lang.String printDetails()
           
 java.lang.String printLockInfo()
           
 void put(Fqn (src)  fqn, java.util.Map data)
          Adds a new node to the tree and sets its data.
 java.lang.Object put(Fqn (src)  fqn, java.lang.Object key, java.lang.Object value)
          Adds a key and value to a given node.
 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 (src)  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 releaseAllLocks(Fqn (src)  fqn)
          Force-releases all locks in this node and the entire subtree
 void releaseAllLocks(java.lang.String fqn)
          Force-releases all locks in this node and the entire subtree
 void remove(Fqn (src)  fqn)
          Removes the node from the tree.
 java.lang.Object remove(Fqn (src)  fqn, java.lang.Object key)
          Removes key from the node's hashmap
 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 (src)  fqn)
           
 void removeData(java.lang.String fqn)
           
 void removeTreeCacheListener(TreeCacheListener (src)  listener)
           
 void rollback(GlobalTransaction (src)  tx)
           
 void setCacheLoader(CacheLoader (src)  cache_loader)
           
 void setCacheLoaderClass(java.lang.String cache_loader_class)
           
 void setCacheLoaderConfig(java.util.Properties cache_loader_config)
           
 void setCacheLoaderFetchPersistentState(boolean flag)
           
 void setCacheLoaderFetchTransientState(boolean flag)
           
 void setCacheLoaderPreload(java.lang.String list)
           
 void setCacheLoaderShared(boolean shared)
           
 void setCacheMode(int mode)
          Sets the default cache mode.
 void setCacheMode(java.lang.String mode)
          Sets the default caching mode)
 void setClusterConfig(org.w3c.dom.Element config)
          Convert a list of elements to the JG property string
 void setClusterName(java.lang.String name)
          Set the name of the replication group
 void setClusterProperties(java.lang.String cluster_props)
          Set the cluster properties.
 void setDeadlockDetection(boolean dt)
           
 void setEvictionPolicyClass(java.lang.String eviction_policy_class)
          Sets the classname of the eviction policy
 void setEvictionPolicyConfig(org.w3c.dom.Element config)
          Setup eviction policy configuration
 void setFetchStateOnStartup(boolean flag)
           
 void setInitialStateRetrievalTimeout(long timeout)
          Set the initial state transfer timeout (see getInitialStateRetrievalTimeout())
 void setIsolationLevel(IsolationLevel (src)  level)
           
 void setIsolationLevel(java.lang.String level)
          Set the transaction isolation level.
 void setLockAcquisitionTimeout(long timeout)
          Set the max time for lock acquisition.
 void setReplicationHandler(Replicatable (src)  handler)
           
 void setReplQueueInterval(long interval)
           
 void setReplQueueMaxElements(int max_elements)
           
 void setStateBytes(byte[] state)
           
 void setSyncCommitPhase(boolean sync_commit_phase)
           
 void setSyncReplTimeout(long timeout)
          Sets the default maximum wait time for synchronous replication to receive all results
 void setSyncRollbackPhase(boolean sync_rollback_phase)
           
 void setTransactionManagerLookup(TransactionManagerLookup (src)  l)
          Sets the TransactionManagerLookup object
 void setTransactionManagerLookupClass(java.lang.String cl)
          Sets the class of the TransactionManagerLookup impl.
 void setUseReplQueue(boolean flag)
           
 void startService()
          Sub-classes should override this method to provide custum 'start' logic.
 void stopService()
          Sub-classes should override this method to provide custum 'stop' logic.
protected  int string2Mode(java.lang.String mode)
           
 void suspect(Address suspected_mbr)
          Called when a member is suspected
 java.lang.String toString()
           
 java.lang.String toString(boolean details)
           
 void viewAccepted(View new_view)
           
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, destroy, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

root

protected Node (src)  root

listeners

protected final java.util.Vector listeners

channel

protected JChannel channel

coordinator

protected boolean coordinator
Am I the coordinator ?


cluster_name

protected java.lang.String cluster_name

cluster_props

protected java.lang.String cluster_props

members

protected final java.util.Vector members

disp

protected RpcDispatcher disp

ml

protected MessageListener ml

state_fetch_timeout

protected long state_fetch_timeout

sync_repl_timeout

protected long sync_repl_timeout

use_repl_queue

protected boolean use_repl_queue

repl_queue_max_elements

protected int repl_queue_max_elements

repl_queue_interval

protected long repl_queue_interval

fetch_state_on_startup

protected boolean fetch_state_on_startup

lock_acquisition_timeout

protected long lock_acquisition_timeout

eviction_policy_class

protected java.lang.String eviction_policy_class

eviction_policy_provider

protected TreeCacheListener (src)  eviction_policy_provider

cache_mode

protected int cache_mode

putDataMethodLocal

public static java.lang.reflect.Method putDataMethodLocal

putDataEraseMethodLocal

public static java.lang.reflect.Method putDataEraseMethodLocal

putKeyValMethodLocal

public static java.lang.reflect.Method putKeyValMethodLocal

putFailFastKeyValueMethodLocal

public static java.lang.reflect.Method putFailFastKeyValueMethodLocal

removeNodeMethodLocal

public static java.lang.reflect.Method removeNodeMethodLocal

removeKeyMethodLocal

public static java.lang.reflect.Method removeKeyMethodLocal

removeDataMethodLocal

public static java.lang.reflect.Method removeDataMethodLocal

evictNodeMethodLocal

public static java.lang.reflect.Method evictNodeMethodLocal

prepareMethod

public static java.lang.reflect.Method prepareMethod

commitMethod

public static java.lang.reflect.Method commitMethod

rollbackMethod

public static java.lang.reflect.Method rollbackMethod

replicateMethod

public static java.lang.reflect.Method replicateMethod

replicateAllMethod

public static java.lang.reflect.Method replicateAllMethod

addChildMethodLocal

public static java.lang.reflect.Method addChildMethodLocal

getKeyValueMethodLocal

public static java.lang.reflect.Method getKeyValueMethodLocal

getNodeMethodLocal

public static java.lang.reflect.Method getNodeMethodLocal

getKeysMethodLocal

public static java.lang.reflect.Method getKeysMethodLocal

getChildrenNamesMethodLocal

public static java.lang.reflect.Method getChildrenNamesMethodLocal

releaseAllLocksMethodLocal

public static java.lang.reflect.Method releaseAllLocksMethodLocal

printMethodLocal

public static java.lang.reflect.Method printMethodLocal

lockMethodLocal

public static java.lang.reflect.Method lockMethodLocal

isStateSet

protected boolean isStateSet

isolationLevel

protected IsolationLevel (src)  isolationLevel

evictConfig_

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


interceptor_chain

protected Interceptor (src)  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.


replication_handler

protected Replicatable (src)  replication_handler
Interceptor which handles invocations of _replicate(MethodCall). Any such method invocation is forwarded to the invoke_handler.
This will go away in the future, as we're moving replication functionality into the ReplicationInterceptor itself


tm_lookup

protected TransactionManagerLookup (src)  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 TransactionManager (src)  tm
Used to get the Transaction associated with the current thread


cache_loader_class

protected java.lang.String cache_loader_class
The fully qualified name of the CacheLoader (has to implement the CacheLoader interface)


cache_loader

protected CacheLoader (src)  cache_loader
A reference to the CacheLoader. If null, we don't have a CachedLoader


cache_loader_config

protected java.util.Properties cache_loader_config
The properties from which to configure the CacheLoader


cache_loader_shared

protected boolean cache_loader_shared
Are the CacheLoaders sharing the same resource or not ?


cache_loader_preload

protected java.util.List cache_loader_preload
List of nodes to preload (if cache loader is enabled)


cache_loader_fetch_transient_state

protected boolean cache_loader_fetch_transient_state
Fetches the transient state. Attribute fetch_cache_on_startup has to be true


cache_loader_fetch_persistent_state

protected boolean cache_loader_fetch_persistent_state
Fetches the entire persistent state from the underlying CacheLoader. Only used if cache_loader_shared=false. Attribute fetch_cache_on_startup has to be true


sync_commit_phase

protected boolean sync_commit_phase
synchronous or asynchrous commit phase ?


sync_rollback_phase

protected boolean sync_rollback_phase
synchronous or asynchrous rollback phase ?


deadlockDetection

protected boolean deadlockDetection

repl_queue

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


SEPARATOR

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

LOCAL

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

See Also:
Constant Field Values (src)

REPL_ASYNC

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

See Also:
Constant Field Values (src)

REPL_SYNC

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

See Also:
Constant Field Values (src)

UNINITIALIZED

public static final java.lang.String UNINITIALIZED
See Also:
Constant Field Values (src)
Constructor Detail

TreeCache

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


TreeCache

public TreeCache()
          throws java.lang.Exception

TreeCache

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

Method Detail

getMessageListener

public MessageListener getMessageListener()

isCrudMethod

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

getRoot

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

Returns:

getLocalAddress

public java.lang.Object getLocalAddress()
Returns:

getMembers

public java.util.Vector getMembers()
Returns:

isCoordinator

public boolean isCoordinator()
Returns:

getClusterName

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


setClusterName

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


getClusterProperties

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


setClusterProperties

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

Parameters:
cluster_props - The properties for the cluster (JGroups)

getTransactionTable

public TransactionTable (src)  getTransactionTable()

getLockTable

public java.util.HashMap getLockTable()

dumpTransactionTable

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

Returns:

getDeadlockDetection

public boolean getDeadlockDetection()
Returns:

setDeadlockDetection

public void setDeadlockDetection(boolean dt)
Parameters:
dt -

getInterceptorChain

public java.lang.String getInterceptorChain()
Returns:

getInterceptors

public java.util.List getInterceptors()
Returns:
List

getCacheLoaderClass

public java.lang.String getCacheLoaderClass()
Returns:

setCacheLoaderClass

public void setCacheLoaderClass(java.lang.String cache_loader_class)
Parameters:
cache_loader_class -

getCacheLoaderConfig

public java.util.Properties getCacheLoaderConfig()
Returns:

setCacheLoaderConfig

public void setCacheLoaderConfig(java.util.Properties cache_loader_config)
Parameters:
cache_loader_config -

getCacheLoader

public CacheLoader (src)  getCacheLoader()
Returns:

setCacheLoader

public void setCacheLoader(CacheLoader (src)  cache_loader)
Parameters:
cache_loader -

getCacheLoaderShared

public boolean getCacheLoaderShared()
Returns:

setCacheLoaderShared

public void setCacheLoaderShared(boolean shared)
Parameters:
shared -

setCacheLoaderPreload

public void setCacheLoaderPreload(java.lang.String list)
Parameters:
list -

getCacheLoaderPreload

public java.lang.String getCacheLoaderPreload()
Returns:

setCacheLoaderFetchPersistentState

public void setCacheLoaderFetchPersistentState(boolean flag)
Parameters:
flag -

getCacheLoaderFetchPersistentState

public boolean getCacheLoaderFetchPersistentState()
Returns:

setCacheLoaderFetchTransientState

public void setCacheLoaderFetchTransientState(boolean flag)
Parameters:
flag -

getCacheLoaderFetchTransientState

public boolean getCacheLoaderFetchTransientState()
Returns:

getSyncCommitPhase

public boolean getSyncCommitPhase()
Returns:

setSyncCommitPhase

public void setSyncCommitPhase(boolean sync_commit_phase)
Parameters:
sync_commit_phase -

getSyncRollbackPhase

public boolean getSyncRollbackPhase()
Returns:

setSyncRollbackPhase

public void setSyncRollbackPhase(boolean sync_rollback_phase)
Parameters:
sync_rollback_phase -

setEvictionPolicyConfig

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


getEvictionPolicyConfig

public org.w3c.dom.Element getEvictionPolicyConfig()

setClusterConfig

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


getInitialStateRetrievalTimeout

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

Returns:
long Number of milliseconds to wait for the state. 0 means to wait forever.

setInitialStateRetrievalTimeout

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


getCacheMode

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

getCacheModeInternal

public int getCacheModeInternal()

setCacheMode

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

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.

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


getUseReplQueue

public boolean getUseReplQueue()
Returns:

setUseReplQueue

public void setUseReplQueue(boolean flag)
Parameters:
flag -

getReplQueueInterval

public long getReplQueueInterval()
Returns:

setReplQueueInterval

public void setReplQueueInterval(long interval)
Parameters:
interval -

getReplQueueMaxElements

public int getReplQueueMaxElements()
Returns:

setReplQueueMaxElements

public void setReplQueueMaxElements(int max_elements)
Parameters:
max_elements -

getReplQueue

public ReplicationQueue (src)  getReplQueue()

getIsolationLevel

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


setIsolationLevel

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


setIsolationLevel

public void setIsolationLevel(IsolationLevel (src)  level)
Parameters:
level -

getIsolationLevelClass

public IsolationLevel (src)  getIsolationLevelClass()

getFetchStateOnStartup

public boolean getFetchStateOnStartup()
Returns:

setFetchStateOnStartup

public void setFetchStateOnStartup(boolean flag)
Parameters:
flag -

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.

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.

Parameters:
timeout -

getEvictionPolicyClass

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

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


getEvictionThreadWakeupIntervalSeconds

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


setTransactionManagerLookup

public void setTransactionManagerLookup(TransactionManagerLookup (src)  l)
Sets the TransactionManagerLookup object

Parameters:
l -

getTransactionManagerLookupClass

public java.lang.String getTransactionManagerLookupClass()
Returns:

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.

Parameters:
cl -
Throws:
java.lang.Exception

getTransactionManager

public TransactionManager (src)  getTransactionManager()
Returns:

getInstance

public TreeCache (src)  getInstance()
Returns:

setReplicationHandler

public void setReplicationHandler(Replicatable (src)  handler)

getReplicationHandler

public Replicatable (src)  getReplicationHandler()

fetchState

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

Throws:
ChannelClosedException
ChannelNotConnectedException

addTreeCacheListener

public void addTreeCacheListener(TreeCacheListener (src)  listener)
Parameters:
listener -

removeTreeCacheListener

public void removeTreeCacheListener(TreeCacheListener (src)  listener)
Parameters:
listener -

createService

public void createService()
                   throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'create' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
createService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

destroyService

public void destroyService()
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'destroy' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
destroyService in class ServiceMBeanSupport (src)

startService

public void startService()
                  throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'start' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
startService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

createInterceptorChain

protected void createInterceptorChain()
                               throws java.lang.IllegalAccessException,
                                      java.lang.InstantiationException,
                                      java.lang.ClassNotFoundException
Assembles the interceptor stack. Presence and order of interceptors is determined by looking at the cache configuration. In the future, this will be accessible through XML. See refactoring.txt for details. An alternative might be to use a simple rools engine to assemble the stack. Creates either:

 CallInterceptor
 LockInterceptor
 [CacheLoaderInterceptor]
 [ReplicationInterceptor]
 [CacheStoreInterceptor]

 or

 CallInterceptor
 LockInterceptor
 [CacheStoreInterceptor]
 [CacheLoaderInterceptor]
 [ReplicationInterceptor]

 
CallInterceptor is always present at the top, the others may or may not be present

Throws:
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.ClassNotFoundException

createCacheLoader

protected void createCacheLoader()
                          throws java.lang.Exception
Creates an instance of a CacheLoader if and only if

Throws:
java.lang.Exception

cacheLoaderPreload

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

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

Parameters:
fqn -
Throws:
java.lang.Exception

determineCoordinator

protected boolean determineCoordinator()

getCoordinator

public Address getCoordinator()

getStateBytes

public byte[] getStateBytes()

setStateBytes

public void setStateBytes(byte[] state)

fetchStateOnStartup

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

stopService

public void stopService()
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'stop' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
stopService in class ServiceMBeanSupport (src)

get

public Node (src)  get(java.lang.String fqn)
         throws CacheException (src) 
Parameters:
fqn - fqn String name to retrieve from cache
Returns:
Node 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 (src)

get

public Node (src)  get(Fqn (src)  fqn)
         throws CacheException (src) 
Parameters:
fqn - fqn instance to retrieve from cache
Returns:
Node 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 (src)

_get

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

getKeys

public java.util.Set getKeys(java.lang.String fqn)
                      throws CacheException (src) 
Parameters:
fqn -
Returns:
Throws:
CacheException (src)

getKeys

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

_getKeys

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

get

public java.lang.Object get(java.lang.String fqn,
                            java.lang.Object key)
                     throws CacheException (src) 
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.

Parameters:
fqn - The fully qualified name of the node.
key - The key.
Throws:
CacheException (src)

get

public java.lang.Object get(Fqn (src)  fqn,
                            java.lang.Object key)
                     throws CacheException (src) 
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.

Parameters:
fqn - The fully qualified name of the node.
key - The key.
Throws:
CacheException (src)

_get

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

get

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

peek

public java.lang.Object peek(Fqn (src)  fqn,
                             java.lang.Object key)
                      throws CacheException (src) 
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 -
Returns:
Throws:
CacheException (src)

exists

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

Parameters:
fqn - The fully qualified name of the node
Returns:
boolean Whether or not the node exists

exists

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

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)
Parameters:
fqn -
key -
Returns:

exists

public boolean exists(Fqn (src)  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)

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

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 (src)

put

public void put(Fqn (src)  fqn,
                java.util.Map data)
         throws CacheException (src) 
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.

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 (src)

put

public java.lang.Object put(java.lang.String fqn,
                            java.lang.Object key,
                            java.lang.Object value)
                     throws CacheException (src) 
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.

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 (src)

putFailFast

public java.lang.Object putFailFast(Fqn (src)  fqn,
                                    java.lang.Object key,
                                    java.lang.Object value,
                                    long timeout)
                             throws CacheException (src) 
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 (src)

putFailFast

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

Parameters:
fqn -
key -
value -
timeout -
Returns:
Throws:
CacheException (src)

put

public java.lang.Object put(Fqn (src)  fqn,
                            java.lang.Object key,
                            java.lang.Object value)
                     throws CacheException (src) 
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.

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 (src)

remove

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

Parameters:
fqn - The fully qualified name of the node.
Throws:
CacheException (src)

remove

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

Parameters:
fqn - The fully qualified name of the node.
Throws:
CacheException (src)

evict

public void evict(Fqn (src)  fqn)
           throws CacheException (src) 
Called by eviction policy provider. Note that eviction is done only in local mode, that is, it doesn't replicate the node removal. This is will cause the replcation nodes not synchronizing, but it is ok since user is supposed to add the node again when get is null. After that, the contents will be in sync.

Parameters:
fqn - Will remove everythign assoicated with this fqn.
Throws:
CacheException (src)

remove

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

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 (src)

remove

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

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 (src)

removeData

public void removeData(java.lang.String fqn)
                throws CacheException (src) 
Parameters:
fqn -
Throws:
CacheException (src)

removeData

public void removeData(Fqn (src)  fqn)
                throws CacheException (src) 
Parameters:
fqn -
Throws:
CacheException (src)

releaseAllLocks

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

Parameters:
fqn -

releaseAllLocks

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

Parameters:
fqn -

print

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


print

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


getChildrenNames

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

Parameters:
fqn - The fully qualified name of the node
Returns:
Set A list of child names (as Strings)
Throws:
CacheException (src)

getChildrenNames

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

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

_getChildrenNames

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

hasChild

public boolean hasChild(Fqn (src)  fqn)

toString

public java.lang.String toString()
Returns:

toString

public java.lang.String toString(boolean details)
Returns:

printDetails

public java.lang.String printDetails()
Returns:

printLockInfo

public java.lang.String printLockInfo()
Returns:

getNumberOfLocksHeld

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

Returns:

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

Returns:

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

Returns:

callRemoteMethods

public java.util.List callRemoteMethods(java.util.Vector mbrs,
                                        MethodCall method_call,
                                        boolean synchronous,
                                        boolean exclude_self,
                                        long timeout)
                                 throws java.lang.Exception
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
Parameters:
members -
method -
args -
synchronous -
exclude_self -
timeout -
Returns:
Throws:
java.lang.Exception

callRemoteMethods

public java.util.List callRemoteMethods(java.util.Vector members,
                                        java.lang.String method_name,
                                        java.lang.Class[] types,
                                        java.lang.Object[] args,
                                        boolean synchronous,
                                        boolean exclude_self,
                                        long timeout)
                                 throws java.lang.Exception
Parameters:
members -
method_name -
types -
args -
synchronous -
exclude_self -
timeout -
Returns:
Throws:
java.lang.Exception

_put

public void _put(GlobalTransaction (src)  tx,
                 java.lang.String fqn,
                 java.util.Map data,
                 boolean create_undo_ops)
          throws CacheException (src) 
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 (src) 's lock list, (b) add nodes that were created to TransactionEntry (src) 's node list and (c) create Modification (src) s and add them to TransactionEntry (src) 's modification list and (d) create compensating modifications to undo the changes in case of a rollback

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 (src)

_put

public void _put(GlobalTransaction (src)  tx,
                 Fqn (src)  fqn,
                 java.util.Map data,
                 boolean create_undo_ops)
          throws CacheException (src) 
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 (src) 's lock list, (b) add nodes that were created to TransactionEntry (src) 's node list and (c) create Modification (src) s and add them to TransactionEntry (src) 's modification list and (d) create compensating modifications to undo the changes in case of a rollback

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 (src)

_put

public void _put(GlobalTransaction (src)  tx,
                 Fqn (src)  fqn,
                 java.util.Map data,
                 boolean create_undo_ops,
                 boolean erase_contents)
          throws CacheException (src) 
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 (src) 's lock list, (b) add nodes that were created to TransactionEntry (src) 's node list and (c) create Modification (src) s and add them to TransactionEntry (src) 's modification list and (d) create compensating modifications to undo the changes in case of a rollback

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 (src)

_put

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

_put

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

_put

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

_remove

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

_remove

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

_remove

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

_remove

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

Parameters:
tx -
fqn -
create_undo_ops -
sendNodeEvent -
Throws:
CacheException (src)

_remove

public java.lang.Object _remove(GlobalTransaction (src)  tx,
                                java.lang.String fqn,
                                java.lang.Object key,
                                boolean create_undo_ops)
                         throws CacheException (src) 
Parameters:
fqn -
key -
Returns:
Object
Throws:
CacheException (src)

_remove

public java.lang.Object _remove(GlobalTransaction (src)  tx,
                                Fqn (src)  fqn,
                                java.lang.Object key,
                                boolean create_undo_ops)
                         throws CacheException (src) 
Parameters:
fqn -
key -
Returns:
Object
Throws:
CacheException (src)

_remove

public java.lang.Object _remove(GlobalTransaction (src)  tx,
                                Fqn (src)  fqn,
                                java.lang.Object key,
                                boolean create_undo_ops,
                                boolean sendNodeEvent)
                         throws CacheException (src) 
Throws:
CacheException (src)

_removeData

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

_removeData

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

_removeData

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

_removeData

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

_evict

public void _evict(Fqn (src)  fqn)
            throws CacheException (src) 
Called by eviction policy provider. Note that eviction is done only in local mode, that is, it doesn't replicate the node removal. This is will cause the replcation nodes not synchronizing, but it is ok since user is supposed to add the node again when get is null. After that, the contents will be in sync.

Parameters:
fqn - Will remove everythign assoicated with this fqn.
Throws:
CacheException (src)

_addChild

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

Parameters:
parent_fqn -
child_name -
old_node -
Throws:
CacheException (src)

_replicate

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

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

_releaseAllLocks

public void _releaseAllLocks(Fqn (src)  fqn)

_print

public java.lang.String _print(Fqn (src)  fqn)

_lock

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

prepare

public void prepare(GlobalTransaction (src)  global_tx,
                    java.util.List modifications,
                    Address coord,
                    boolean commit)

commit

public void commit(GlobalTransaction (src)  tx)

rollback

public void rollback(GlobalTransaction (src)  tx)

addNode

public void addNode(GlobalTransaction (src)  gtx,
                    Fqn (src)  node)

viewAccepted

public void viewAccepted(View new_view)

suspect

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


block

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


getLocalTransaction

protected Transaction (src)  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()

Returns:

getCurrentTransaction

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

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

getCurrentTransaction

public GlobalTransaction (src)  getCurrentTransaction(Transaction (src)  tx)

invokeMethod

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

Parameters:
m -
Returns:
Throws:
CacheException (src)

notifyNodeCreated

public void notifyNodeCreated(Fqn (src)  fqn)

notifyNodeLoaded

public void notifyNodeLoaded(Fqn (src)  fqn)

notifyNodeRemoved

protected void notifyNodeRemoved(Fqn (src)  fqn)

notifyNodeEvicted

protected void notifyNodeEvicted(Fqn (src)  fqn)

notifyNodeModified

protected void notifyNodeModified(Fqn (src)  fqn)

notifyNodeVisisted

protected void notifyNodeVisisted(Fqn (src)  fqn)

notifyCacheStarted

protected void notifyCacheStarted()

notifyCacheStopped

protected void notifyCacheStopped()

notifyViewChange

protected void notifyViewChange(View v)

notifyAllNodesCreated

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


getDefaultProperties

protected java.lang.String getDefaultProperties()

string2Mode

protected int string2Mode(java.lang.String mode)