站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 Cache API Documentation 英文版文档

TreeCache (JBoss Cache API) - JBoss 3.2.7 Cache API Documentation 英文版文档


org.jboss.cache
Class TreeCache

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.cache.TreeCache
All Implemented Interfaces:
Cloneable, javax.management.MBeanRegistration, org.jgroups.MembershipListener, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean, TreeCacheMBean

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

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

Version:
$Id: TreeCache.java,v 1.79.2.18 2005/01/04 23:51:23 bwang00 Exp $
Author:
Bela Ban, Ben Wang

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

Field Detail

root

protected Node root

listeners

protected final Vector listeners

channel

protected org.jgroups.JChannel channel

coordinator

protected boolean coordinator
Am I the coordinator ?


cluster_name

protected String cluster_name

cluster_props

protected String cluster_props

members

protected final Vector members

disp

protected org.jgroups.blocks.RpcDispatcher disp

ml

protected org.jgroups.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 String eviction_policy_class

eviction_policy_provider

protected TreeCacheListener eviction_policy_provider

cache_mode

protected int cache_mode

putDataMethodLocal

public static Method putDataMethodLocal

putDataEraseMethodLocal

public static Method putDataEraseMethodLocal

putKeyValMethodLocal

public static Method putKeyValMethodLocal

removeNodeMethodLocal

public static Method removeNodeMethodLocal

removeKeyMethodLocal

public static Method removeKeyMethodLocal

removeDataMethodLocal

public static Method removeDataMethodLocal

evictNodeMethodLocal

public static Method evictNodeMethodLocal

evictKeyValueMethodLocal

public static Method evictKeyValueMethodLocal

prepareMethod

public static Method prepareMethod

commitMethod

public static Method commitMethod

rollbackMethod

public static Method rollbackMethod

replicateMethod

public static Method replicateMethod

replicateAllMethod

public static Method replicateAllMethod

addChildMethodLocal

public static Method addChildMethodLocal

getKeyValueMethodLocal

public static Method getKeyValueMethodLocal

getNodeMethodLocal

public static Method getNodeMethodLocal

getKeysMethodLocal

public static Method getKeysMethodLocal

getChildrenNamesMethodLocal

public static Method getChildrenNamesMethodLocal

releaseAllLocksMethodLocal

public static Method releaseAllLocksMethodLocal

printMethodLocal

public static Method printMethodLocal

isStateSet

protected boolean isStateSet

isolationLevel

protected IsolationLevel isolationLevel

evictConfig_

protected Element evictConfig_
Eviction policy configuration in xml Element


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.


replication_handler

protected Replicatable 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 tm_lookup
Method to acquire a TransactionManager. By default we use JBossTransactionManagerLookup. Has to be set before calling ServiceMBeanSupport.start()


tm_lookup_class

protected String tm_lookup_class
Class of the implementation of TransactionManagerLookup


tm

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


cache_loader_class

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


cache_loader

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


cache_loader_config

protected 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 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 ?


jndi_name

protected String jndi_name

repl_queue

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


SEPARATOR

public static final String SEPARATOR
See Also:
Constant Field Values

LOCAL

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

See Also:
Constant Field Values

REPL_ASYNC

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

See Also:
Constant Field Values

REPL_SYNC

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

See Also:
Constant Field Values

UNINITIALIZED

public static final String UNINITIALIZED
See Also:
Constant Field Values
Constructor Detail

TreeCache

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


TreeCache

public TreeCache()
          throws Exception

TreeCache

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

Method Detail

getMessageListener

public org.jgroups.MessageListener getMessageListener()

isCrudMethod

public static boolean isCrudMethod(Method m)

getRoot

public Node 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 Object getLocalAddress()
Specified by:
getLocalAddress in interface TreeCacheMBean
Returns:

getMembers

public Vector getMembers()
Specified by:
getMembers in interface TreeCacheMBean
Returns:

isCoordinator

public boolean isCoordinator()
Specified by:
isCoordinator in interface TreeCacheMBean
Returns:

getClusterName

public String getClusterName()
Get the name of the replication group

Specified by:
getClusterName in interface TreeCacheMBean

setClusterName

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

Specified by:
setClusterName in interface TreeCacheMBean

getClusterProperties

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

Specified by:
getClusterProperties in interface TreeCacheMBean

setClusterProperties

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

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

getTransactionTable

public TransactionTable getTransactionTable()

dumpTransactionTable

public String dumpTransactionTable()
Dumps the contents of the TransactionTable

Specified by:
dumpTransactionTable in interface TreeCacheMBean
Returns:

getInterceptorChain

public String getInterceptorChain()
Specified by:
getInterceptorChain in interface TreeCacheMBean
Returns:

getInterceptors

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

getCacheLoaderClass

public String getCacheLoaderClass()
Specified by:
getCacheLoaderClass in interface TreeCacheMBean
Returns:

setCacheLoaderClass

public void setCacheLoaderClass(String cache_loader_class)
Specified by:
setCacheLoaderClass in interface TreeCacheMBean
Parameters:
cache_loader_class -

getCacheLoaderConfig

public Properties getCacheLoaderConfig()
Specified by:
getCacheLoaderConfig in interface TreeCacheMBean
Returns:

setCacheLoaderConfig

public void setCacheLoaderConfig(Properties cache_loader_config)
Specified by:
setCacheLoaderConfig in interface TreeCacheMBean
Parameters:
cache_loader_config -

getCacheLoader

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

setCacheLoader

public void setCacheLoader(CacheLoader cache_loader)
Specified by:
setCacheLoader in interface TreeCacheMBean
Parameters:
cache_loader -

getCacheLoaderShared

public boolean getCacheLoaderShared()
Specified by:
getCacheLoaderShared in interface TreeCacheMBean
Returns:

setCacheLoaderShared

public void setCacheLoaderShared(boolean shared)
Specified by:
setCacheLoaderShared in interface TreeCacheMBean
Parameters:
shared -

setCacheLoaderPreload

public void setCacheLoaderPreload(String list)
Specified by:
setCacheLoaderPreload in interface TreeCacheMBean
Parameters:
list -

getCacheLoaderPreload

public String getCacheLoaderPreload()
Specified by:
getCacheLoaderPreload in interface TreeCacheMBean
Returns:

setCacheLoaderFetchPersistentState

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

getCacheLoaderFetchPersistentState

public boolean getCacheLoaderFetchPersistentState()
Specified by:
getCacheLoaderFetchPersistentState in interface TreeCacheMBean
Returns:

setCacheLoaderFetchTransientState

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

getCacheLoaderFetchTransientState

public boolean getCacheLoaderFetchTransientState()
Specified by:
getCacheLoaderFetchTransientState in interface TreeCacheMBean
Returns:

getSyncCommitPhase

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

setSyncCommitPhase

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

getSyncRollbackPhase

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

setSyncRollbackPhase

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

setEvictionPolicyConfig

public void setEvictionPolicyConfig(Element config)
Setup eviction policy configuration

Specified by:
setEvictionPolicyConfig in interface TreeCacheMBean

getEvictionPolicyConfig

public Element getEvictionPolicyConfig()

setClusterConfig

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

Specified by:
setClusterConfig in interface TreeCacheMBean

getInitialStateRetrievalTimeout

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

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

setInitialStateRetrievalTimeout

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

Specified by:
setInitialStateRetrievalTimeout in interface TreeCacheMBean

getCacheMode

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

getCacheModeInternal

public int getCacheModeInternal()

setCacheMode

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

Specified by:
setCacheMode in interface TreeCacheMBean
Throws:
Exception

setCacheMode

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

Parameters:
mode -

getSyncReplTimeout

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

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

setSyncReplTimeout

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

Specified by:
setSyncReplTimeout in interface TreeCacheMBean

getUseReplQueue

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

setUseReplQueue

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

getReplQueueInterval

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

setReplQueueInterval

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

getReplQueueMaxElements

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

setReplQueueMaxElements

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

getReplQueue

public ReplicationQueue getReplQueue()

getIsolationLevel

public String getIsolationLevel()
Returns the transaction isolation level.

Specified by:
getIsolationLevel in interface TreeCacheMBean

setIsolationLevel

public void setIsolationLevel(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()
Specified by:
getFetchStateOnStartup in interface TreeCacheMBean
Returns:

setFetchStateOnStartup

public void setFetchStateOnStartup(boolean flag)
Specified by:
setFetchStateOnStartup in interface TreeCacheMBean
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.

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 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(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 String getTransactionManagerLookupClass()
Specified by:
getTransactionManagerLookupClass in interface TreeCacheMBean
Returns:

setTransactionManagerLookupClass

public void setTransactionManagerLookupClass(String cl)
                                      throws 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:
Exception

getTransactionManager

public TransactionManager getTransactionManager()
Specified by:
getTransactionManager in interface TreeCacheMBean
Returns:

getInstance

public TreeCache getInstance()
Specified by:
getInstance in interface TreeCacheMBean
Returns:

getJndiName

public String getJndiName()
Specified by:
getJndiName in interface TreeCacheMBean
Returns:

setJndiName

public void setJndiName(String jndi_name)
                 throws Exception
Specified by:
setJndiName in interface TreeCacheMBean
Parameters:
jndi_name - properties
Throws:
Exception

setReplicationHandler

public void setReplicationHandler(Replicatable handler)

getReplicationHandler

public Replicatable getReplicationHandler()

fetchState

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

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

addTreeCacheListener

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

removeTreeCacheListener

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

createService

public void createService()
                   throws Exception
Specified by:
createService in interface TreeCacheMBean
Throws:
Exception

destroyService

public void destroyService()
Specified by:
destroyService in interface TreeCacheMBean

startService

public void startService()
                  throws Exception
Specified by:
startService in interface TreeCacheMBean
Throws:
Exception

createInterceptorChain

protected void createInterceptorChain()
                               throws IllegalAccessException,
                                      InstantiationException,
                                      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
 CreateIfNotExistsInterceptor
 [CacheLoaderInterceptor]
 [ReplicationInterceptor]
 [CacheStoreInterceptor]

 or

 CallInterceptor
 LockInterceptor
 CreateIfNotExistsInterceptor
 [CacheStoreInterceptor]
 [CacheLoaderInterceptor]
 [ReplicationInterceptor]

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

Throws:
IllegalAccessException
InstantiationException
ClassNotFoundException

createCacheLoader

protected void createCacheLoader()
                          throws Exception
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)

Throws:
Exception

startCacheLoader

protected void startCacheLoader()
                         throws Exception
Throws:
Exception

load

public void load(String fqn)
          throws 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:
Exception

determineCoordinator

protected boolean determineCoordinator()

fetchStateOnStartup

protected void fetchStateOnStartup()
                            throws Exception
Throws:
Exception

stopService

public void stopService()
Specified by:
stopService in interface TreeCacheMBean

get

public Node get(String fqn)
         throws CacheException
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

get

public Node get(Fqn fqn)
         throws CacheException
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

_get

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

getKeys

public Set getKeys(String fqn)
            throws CacheException
Specified by:
getKeys in interface TreeCacheMBean
Parameters:
fqn -
Returns:
Throws:
CacheException

getKeys

public Set getKeys(Fqn fqn)
            throws CacheException
Specified by:
getKeys in interface TreeCacheMBean
Parameters:
fqn -
Returns:
A Set of keys. This is an unmodifiable set, any attempt to modify it will throw an exception. Returns null if the node is not found, or the node has no attributes
Throws:
CacheException

_getKeys

public Set _getKeys(Fqn fqn)
             throws CacheException
Throws:
CacheException

get

public Object get(String fqn,
                  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 Object get(Fqn fqn,
                  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 Object _get(Fqn fqn,
                   Object key,
                   boolean sendNodeEvent)
            throws CacheException
Throws:
CacheException

get

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

peek

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

Parameters:
fqn -
key -
Returns:
Throws:
CacheException

exists

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

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

exists

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

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

exists

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

exists

public boolean exists(Fqn fqn,
                      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(String fqn,
                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,
                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 Object put(String fqn,
                  Object key,
                  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

put

public Object put(Fqn fqn,
                  Object key,
                  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(String fqn)
            throws CacheException
Removes the node from the tree.

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

remove

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

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

evict

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

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

evict

public void evict(Fqn fqn,
                  Object key)
           throws CacheException
Evicts a key/value pair from a node's attributes. Note that this is local, will not be replicated.

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

remove

public Object remove(String fqn,
                     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 Object remove(Fqn fqn,
                     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(String fqn)
                throws CacheException
Specified by:
removeData in interface TreeCacheMBean
Parameters:
fqn -
Throws:
CacheException

removeData

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

lock

public void lock(Fqn fqn,
                 Object owner,
                 int lock_type,
                 boolean lock_recursive)
          throws CacheException
Lock a given node (or the entire subtree starting at this node)

Parameters:
fqn - The FQN of the node
owner - The owner. This is simply a key into a hashtable, and can be anything, e.g. a GlobalTransaction, the current thread, or a special object. If null, it is set to Thread.currentThread()
lock_type - The type of lock (RO, RW). Needs to be of type Node.LOCK_TYPE_READ or Node.LOCK_TYPE_WRITE
lock_recursive - If true, the entire subtree is locked, else only the given node
Throws:
CacheException - If node doesn't exist, a NodeNotExistsException is throw. Other exceptions are LockingException, TimeoutException and UpgradeException

unlock

public void unlock(Fqn fqn,
                   Object owner,
                   boolean unlock_recursive,
                   boolean force)
Unlock a given node (or the entire subtree starting at this node)

Parameters:
fqn - The FQN of the node
owner - The owner. This is simply a key into a hashtable, and can be anything, e.g. a GlobalTransaction, the current thread, or a special object. If null, it is set to Thread.currentThread()
unlock_recursive - If true, the entire subtree is unlocked, else only the given node
force - Release the lock even if we're not the owner

releaseAllLocks

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

Specified by:
releaseAllLocks in interface TreeCacheMBean
Parameters:
fqn -

releaseAllLocks

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

Specified by:
releaseAllLocks in interface TreeCacheMBean
Parameters:
fqn -

print

public String print(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 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 Set getChildrenNames(String fqn)
                     throws CacheException
Returns all children of a given node

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

getChildrenNames

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

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

_getChildrenNames

public Set _getChildrenNames(Fqn fqn)
                      throws CacheException
Throws:
CacheException

hasChild

public boolean hasChild(Fqn fqn)

toString

public String toString()
Specified by:
toString in interface TreeCacheMBean
Returns:

printDetails

public String printDetails()
Specified by:
printDetails in interface TreeCacheMBean
Returns:

printLockInfo

public String printLockInfo()
Specified by:
printLockInfo in interface TreeCacheMBean
Returns:

getNumberOfLocksHeld

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

Specified by:
getNumberOfLocksHeld in interface TreeCacheMBean
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

Specified by:
getNumberOfNodes in interface TreeCacheMBean
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

Specified by:
getNumberOfAttributes in interface TreeCacheMBean
Returns:

callRemoteMethods

public List callRemoteMethods(Vector mbrs,
                              org.jgroups.blocks.MethodCall method_call,
                              boolean synchronous,
                              boolean exclude_self,
                              long timeout)
                       throws Exception
Throws:
Exception

callRemoteMethods

public List callRemoteMethods(Vector members,
                              Method method,
                              Object[] args,
                              boolean synchronous,
                              boolean exclude_self,
                              long timeout)
                       throws Exception
Specified by:
callRemoteMethods in interface TreeCacheMBean
Parameters:
members -
method -
args -
synchronous -
exclude_self -
timeout -
Returns:
Throws:
Exception

callRemoteMethods

public List callRemoteMethods(Vector members,
                              String method_name,
                              Class[] types,
                              Object[] args,
                              boolean synchronous,
                              boolean exclude_self,
                              long timeout)
                       throws Exception
Specified by:
callRemoteMethods in interface TreeCacheMBean
Parameters:
members -
method_name -
types -
args -
synchronous -
exclude_self -
timeout -
Returns:
Throws:
Exception

_put

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

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

_put

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

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

_put

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

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

_put

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

_put

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

_remove

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

_remove

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

_remove

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

_remove

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

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

_remove

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

_remove

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

_remove

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

_removeData

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

_removeData

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

_removeData

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

_removeData

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

_evict

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

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

_evict

public void _evict(Fqn fqn,
                   Object key)
            throws CacheException
Evicts a key/value pair from a node's attributes. Note that this is local, will not be replicated.

Parameters:
fqn -
key -
Throws:
CacheException

_addChild

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

Parameters:
parent_fqn -
child_name -
old_node -
Throws:
CacheException

_replicate

public Object _replicate(org.jgroups.blocks.MethodCall method_call)
                  throws 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:
Throwable

_replicate

public void _replicate(List method_calls)
                throws Throwable
Throws:
Throwable

_releaseAllLocks

public void _releaseAllLocks(Fqn fqn)

_print

public String _print(Fqn fqn)

prepare

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

commit

public void commit(GlobalTransaction tx)

rollback

public void rollback(GlobalTransaction tx)

addNode

public void addNode(GlobalTransaction gtx,
                    Fqn node)

viewAccepted

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

suspect

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

Specified by:
suspect in interface org.jgroups.MembershipListener

block

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

Specified by:
block in interface org.jgroups.MembershipListener

getLocalTransaction

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

Returns:

getCurrentTransaction

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

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

getCurrentTransaction

public GlobalTransaction getCurrentTransaction(Transaction tx)

invokeMethod

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

Parameters:
m -
Returns:
Throws:
CacheException

notifyNodeCreated

public void notifyNodeCreated(Fqn fqn)

notifyNodeLoaded

public void notifyNodeLoaded(Fqn fqn)

notifyNodeRemoved

protected void notifyNodeRemoved(Fqn fqn)

notifyNodeEvicted

protected void notifyNodeEvicted(Fqn fqn)

notifyNodeModified

protected void notifyNodeModified(Fqn fqn)

notifyNodeVisisted

protected void notifyNodeVisisted(Fqn fqn)

notifyCacheStarted

protected void notifyCacheStarted()

notifyCacheStopped

protected void notifyCacheStopped()

notifyViewChange

protected void notifyViewChange(org.jgroups.View v)

notifyAllNodesCreated

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


getDefaultProperties

protected String getDefaultProperties()

string2Mode

protected int string2Mode(String mode)


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