org.jboss.cache
Interface TreeCacheMBean

All Superinterfaces:
org.jboss.system.Service, org.jboss.system.ServiceMBean
All Known Subinterfaces:
RpcTreeCacheMBean, TreeCacheAopMBean
All Known Implementing Classes:
RpcTreeCache, TreeCache, TreeCacheAop

public interface TreeCacheMBean
extends org.jboss.system.ServiceMBean

MBean interface.

Version:
$Id: TreeCacheMBean.java,v 1.7.2.4.4.3 2006/02/21 18:33:13 bstansberry Exp $
Author:
Bela Ban, Ben Wang

Field Summary
 
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
 
Method Summary
 void _put(GlobalTransaction tx, Fqn fqn, java.util.Map data, boolean create_undo_ops)
          Does the real work.
 void _put(GlobalTransaction tx, Fqn fqn, java.util.Map data, boolean create_undo_ops, boolean erase_contents)
          Does the real work.
 java.lang.Object _put(GlobalTransaction tx, Fqn fqn, java.lang.Object key, java.lang.Object value, boolean create_undo_ops)
           
 void _put(GlobalTransaction tx, java.lang.String fqn, java.util.Map data, boolean create_undo_ops)
          Does the real work.
 java.lang.Object _put(GlobalTransaction tx, java.lang.String fqn, java.lang.Object key, java.lang.Object value, boolean create_undo_ops)
           
 void _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops)
           
 java.lang.Object _remove(GlobalTransaction tx, Fqn fqn, java.lang.Object key, boolean create_undo_ops)
           
 void _remove(GlobalTransaction tx, java.lang.String fqn, boolean create_undo_ops)
           
 java.lang.Object _remove(GlobalTransaction tx, java.lang.String fqn, java.lang.Object key, boolean create_undo_ops)
           
 void activateRegion(java.lang.String subtreeFqn)
          Causes the cache to transfer state for the subtree rooted at subtreeFqn and to begin accepting replication messages for that subtree.
 void addTreeCacheListener(TreeCacheListener listener)
           
 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 createService()
           
 void destroyService()
           
 java.lang.String dumpTransactionTable()
          Dumps the contents of the TransactionTable
 void evict(Fqn fqn)
          Called by eviction policy provider.
 boolean exists(Fqn fqn)
          Checks whether a given node exists in the tree.
 boolean exists(Fqn fqn, java.lang.Object key)
          Checks whether a given key exists in the given node.
 boolean exists(java.lang.String fqn)
          Checks whether a given node exists in the tree
 boolean exists(java.lang.String fqn, java.lang.Object key)
           
 void fetchState(long timeout)
          Fetch the group state from the current coordinator.
 Node get(Fqn fqn)
           
 java.lang.Object get(Fqn fqn, java.lang.Object key)
          Finds a node given its name and returns the value associated with a given key in its data map.
 Node get(java.lang.String fqn)
           
 java.lang.Object get(java.lang.String fqn, java.lang.Object key)
          Finds a node given its name and returns the value associated with a given key in its data map.
 CacheLoader getCacheLoader()
           
 boolean getCacheLoaderAsynchronous()
           
 java.lang.String getCacheLoaderClass()
           
 java.util.Properties getCacheLoaderConfig()
           
 boolean getCacheLoaderFetchPersistentState()
           
 boolean getCacheLoaderFetchTransientState()
           
 boolean getCacheLoaderPassivation()
           
 java.lang.String getCacheLoaderPreload()
           
 boolean getCacheLoaderShared()
           
 java.lang.String getCacheMode()
          Returns the current caching mode.
 java.util.Set getChildrenNames(Fqn 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.
 boolean getDeadlockDetection()
           
 java.lang.String getEvictionPolicyClass()
          Returns the name of the cache eviction policy (must be an implementation of EvictionPolicy)
 int getEvictionThreadWakeupIntervalSeconds()
          Obtain eviction thread (if any) wake up interval in seconds
 boolean getFetchStateOnStartup()
          Returns whether or not on startup to acquire the initial state from existing members.
 long getInitialStateRetrievalTimeout()
          Get the max time to wait until the initial state is retrieved.
 TreeCache getInstance()
           
 java.lang.String getInterceptorChain()
           
 java.util.List getInterceptors()
           
 java.lang.String getIsolationLevel()
          Returns the transaction isolation level.
 java.util.Set getKeys(Fqn fqn)
           
 java.util.Set getKeys(java.lang.String fqn)
           
 java.lang.Object getLocalAddress()
           
 long getLockAcquisitionTimeout()
          Default max time to wait for a lock.
 java.util.Vector getMembers()
           
 java.lang.String getNodeLockingScheme()
           
 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.
 java.lang.String getReplicationVersion()
          Gets the format version of the data transferred during an initial state transfer or a call to activateRegion(String).
 long getReplQueueInterval()
           
 int getReplQueueMaxElements()
           
 short getStateTransferVersion()
          Deprecated. use getReplicationVersion() instead
 boolean getSyncCommitPhase()
           
 long getSyncReplTimeout()
          Returns the default max timeout after which synchronous replication calls return.
 boolean getSyncRollbackPhase()
           
 javax.transaction.TransactionManager getTransactionManager()
           
 java.lang.String getTransactionManagerLookupClass()
           
 boolean getUseMarshalling()
          Gets whether a TreeCacheMarshaller instance should be used to manage different classloaders to use for unmarshalling replicated objects.
 boolean getUseReplQueue()
           
 java.lang.String getVersion()
           
 void inactivateRegion(java.lang.String subtreeFqn)
          Causes the cache to stop accepting replication events for the subtree rooted at subtreeFqn and evict all nodes in that subtree.
 boolean isCoordinator()
           
 boolean isInactiveOnStartup()
          Gets whether the entire tree is inactive upon startup, only responding to replication messages after activateRegion(String) is called to activate one or more parts of the tree.
 void load(java.lang.String fqn)
          Loads the indicated Fqn, plus all parents recursively from the CacheLoader.
 java.lang.String print(Fqn fqn)
          Prints a representation of the node defined by fqn.
 java.lang.String print(java.lang.String fqn)
          Prints a representation of the node defined by fqn.
 java.lang.String printDetails()
           
 java.lang.String printLockInfo()
           
 void put(Fqn fqn, java.util.Map data)
          Adds a new node to the tree and sets its data.
 java.lang.Object put(Fqn fqn, java.lang.Object key, java.lang.Object value)
          Adds a key and value to a given node.
 void put(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.
 void registerClassLoader(java.lang.String fqn, java.lang.ClassLoader cl)
          Registers the given classloader with TreeCacheMarshaller for use in unmarshalling replicated objects for the specified region.
 void releaseAllLocks(Fqn fqn)
          Force-releases all locks in this node and the entire subtree
 void releaseAllLocks(java.lang.String fqn)
          Force-releases all locks in this node and the entire subtree
 void remove(Fqn fqn)
          Removes the node from the tree.
 java.lang.Object remove(Fqn fqn, java.lang.Object key)
          Removes key from the node's hashmap
 void remove(java.lang.String fqn)
          Removes the node from the tree.
 java.lang.Object remove(java.lang.String fqn, java.lang.Object key)
          Removes key from the node's hashmap
 void removeData(Fqn fqn)
           
 void removeData(java.lang.String fqn)
           
 void removeTreeCacheListener(TreeCacheListener listener)
           
 void setCacheLoader(CacheLoader cache_loader)
           
 void setCacheLoaderAsynchronous(boolean flag)
           
 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 setCacheLoaderPassivation(boolean passivate)
           
 void setCacheLoaderPreload(java.lang.String list)
           
 void setCacheLoaderShared(boolean shared)
           
 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)
          Sets whether or not on startup to acquire the initial state from existing members.
 void setInactiveOnStartup(boolean inactiveOnStartup)
          Sets whether the entire tree is inactive upon startup, only responding to replication messages after activateRegion(String) is called to activate one or more parts of the tree.
 void setInitialStateRetrievalTimeout(long timeout)
          Set the initial state transfer timeout (see getInitialStateRetrievalTimeout())
 void setIsolationLevel(java.lang.String level)
          Set the transaction isolation level.
 void setLockAcquisitionTimeout(long timeout)
          Set the max time for lock acquisition.
 void setNodeLockingScheme(java.lang.String nodeLockingScheme)
           
 void setReplicationVersion(java.lang.String version)
          Sets the format version of the data transferred during an initial state transfer or a call to activateRegion(String).
 void setReplQueueInterval(long interval)
           
 void setReplQueueMaxElements(int max_elements)
           
 void setStateTransferVersion(short version)
          Deprecated. use setReplicationVersion(String) instead
 void setSyncCommitPhase(boolean sync_commit_phase)
           
 void setSyncReplTimeout(long timeout)
          Sets the default maximum wait time for synchronous replication to receive all results
 void setSyncRollbackPhase(boolean sync_rollback_phase)
           
 void setTransactionManagerLookup(TransactionManagerLookup l)
          Sets the TransactionManagerLookup object
 void setTransactionManagerLookupClass(java.lang.String cl)
          Sets the class of the TransactionManagerLookup impl.
 void setUseMarshalling(boolean isTrue)
          Sets whether a TreeCacheMarshaller instance should be created to manage different classloaders to use for unmarshalling replicated objects.
 void setUseReplQueue(boolean flag)
           
 void startService()
           
 void stopService()
           
 java.lang.String toString()
           
 void unregisterClassLoader(java.lang.String fqn)
          Instructs the TreeCacheMarshaller to no longer use a special classloader to unmarshal replicated objects for the specified region.
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Method Detail

getLocalAddress

public java.lang.Object getLocalAddress()

getMembers

public java.util.Vector getMembers()

isCoordinator

public boolean isCoordinator()

getClusterName

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


getVersion

public java.lang.String getVersion()

setClusterName

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


setUseMarshalling

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

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


getUseMarshalling

public boolean getUseMarshalling()
Gets whether a TreeCacheMarshaller instance should be used to manage different classloaders to use for unmarshalling replicated objects.


registerClassLoader

public void registerClassLoader(java.lang.String fqn,
                                java.lang.ClassLoader cl)
                         throws RegionNameConflictException
Registers the given classloader with TreeCacheMarshaller for use in unmarshalling replicated objects for the specified region.

Parameters:
fqn - The fqn region. This fqn and its children will use this classloader for (un)marshalling.
cl - The class loader to use
Throws:
RegionNameConflictException - if fqn is a descendant of an FQN that already has a classloader registered.
java.lang.IllegalStateException - if useMarshalling is false

unregisterClassLoader

public void unregisterClassLoader(java.lang.String fqn)
                           throws RegionNotFoundException
Instructs the TreeCacheMarshaller to no longer use a special classloader to unmarshal replicated objects for the specified region.

Parameters:
fqn - The fqn of the root node of region.
Throws:
RegionNotFoundException - if no classloader has been registered for fqn.
java.lang.IllegalStateException - if useMarshalling is false

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)

dumpTransactionTable

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

Returns:

getInterceptorChain

public java.lang.String getInterceptorChain()

getInterceptors

public java.util.List getInterceptors()

getCacheLoaderClass

public java.lang.String getCacheLoaderClass()

setCacheLoaderClass

public void setCacheLoaderClass(java.lang.String cache_loader_class)

getCacheLoaderConfig

public java.util.Properties getCacheLoaderConfig()

setCacheLoaderConfig

public void setCacheLoaderConfig(java.util.Properties cache_loader_config)

getCacheLoader

public CacheLoader getCacheLoader()

setCacheLoader

public void setCacheLoader(CacheLoader cache_loader)

getCacheLoaderShared

public boolean getCacheLoaderShared()

setCacheLoaderShared

public void setCacheLoaderShared(boolean shared)

setCacheLoaderPreload

public void setCacheLoaderPreload(java.lang.String list)

getCacheLoaderPreload

public java.lang.String getCacheLoaderPreload()

getCacheLoaderPassivation

public boolean getCacheLoaderPassivation()

setCacheLoaderPassivation

public void setCacheLoaderPassivation(boolean passivate)

setCacheLoaderFetchPersistentState

public void setCacheLoaderFetchPersistentState(boolean flag)

getCacheLoaderFetchPersistentState

public boolean getCacheLoaderFetchPersistentState()

setCacheLoaderFetchTransientState

public void setCacheLoaderFetchTransientState(boolean flag)

getCacheLoaderFetchTransientState

public boolean getCacheLoaderFetchTransientState()

setCacheLoaderAsynchronous

public void setCacheLoaderAsynchronous(boolean flag)

getCacheLoaderAsynchronous

public boolean getCacheLoaderAsynchronous()

getSyncCommitPhase

public boolean getSyncCommitPhase()

setSyncCommitPhase

public void setSyncCommitPhase(boolean sync_commit_phase)

getSyncRollbackPhase

public boolean getSyncRollbackPhase()

setSyncRollbackPhase

public void setSyncRollbackPhase(boolean sync_rollback_phase)

setEvictionPolicyConfig

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


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

setCacheMode

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

java.lang.Exception

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

setUseReplQueue

public void setUseReplQueue(boolean flag)

getReplQueueInterval

public long getReplQueueInterval()

setReplQueueInterval

public void setReplQueueInterval(long interval)

getReplQueueMaxElements

public int getReplQueueMaxElements()

setReplQueueMaxElements

public void setReplQueueMaxElements(int max_elements)

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


getFetchStateOnStartup

public boolean getFetchStateOnStartup()
Returns whether or not on startup to acquire the initial state from existing members. Allows for warm/hot caches (true/false). This can be further defined by properties CacheLoaderFetchTransientState and CacheLoaderFetchPersistentState.


setFetchStateOnStartup

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


getStateTransferVersion

public short getStateTransferVersion()
Deprecated. use getReplicationVersion() instead

Gets the format version of the data transferred during an initial state transfer or a call to activateRegion(String). Different releases of JBossCache may format this data differently; this property identifies the format version being used by this cache instance.

The default value for this property is TreeCache.DEFAULT_REPLICATION_VERSION.

Returns:
a short identifying JBossCache release; e.g. 124 for JBossCache 1.2.4

setStateTransferVersion

public void setStateTransferVersion(short version)
Deprecated. use setReplicationVersion(String) instead

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

Parameters:
version - a short identifying JBossCache release; e.g. 124 for JBossCache 1.2.4

getReplicationVersion

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

The default value for this property is TreeCache.DEFAULT_REPLICATION_VERSION.

Returns:
a short identifying JBossCache release; e.g. 124 for JBossCache 1.2.4

setReplicationVersion

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

Parameters:
version - a short identifying JBossCache release; e.g. 124 for JBossCache 1.2.4

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 -

getDeadlockDetection

public boolean getDeadlockDetection()

setDeadlockDetection

public void setDeadlockDetection(boolean dt)

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 l)
Sets the TransactionManagerLookup object

Parameters:
l -

getTransactionManagerLookupClass

public java.lang.String getTransactionManagerLookupClass()

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 javax.transaction.TransactionManager getTransactionManager()

getInstance

public TreeCache getInstance()

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

org.jgroups.ChannelClosedException
org.jgroups.ChannelNotConnectedException

addTreeCacheListener

public void addTreeCacheListener(TreeCacheListener listener)

removeTreeCacheListener

public void removeTreeCacheListener(TreeCacheListener listener)

createService

public void createService()
                   throws java.lang.Exception
java.lang.Exception

destroyService

public void destroyService()

startService

public void startService()
                  throws java.lang.Exception
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

stopService

public void stopService()

getKeys

public java.util.Set getKeys(java.lang.String fqn)
                      throws CacheException
CacheException

getKeys

public java.util.Set getKeys(Fqn fqn)
                      throws CacheException
CacheException

get

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

Parameters:
fqn - The fully qualified name of the node.
key - The key.
CacheException

get

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

Parameters:
fqn - The fully qualified name of the node.
key - The key.
CacheException

get

public Node get(java.lang.String fqn)
         throws CacheException
CacheException

get

public Node get(Fqn fqn)
         throws CacheException
CacheException

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

exists

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

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

put

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

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

put

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

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

put

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

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
CacheException

put

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

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
CacheException

remove

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

Parameters:
fqn - The fully qualified name of the node.
CacheException

remove

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

Parameters:
fqn - The fully qualified name of the node.
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

remove

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

remove

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

removeData

public void removeData(java.lang.String fqn)
                throws CacheException
CacheException

removeData

public void removeData(Fqn fqn)
                throws CacheException
CacheException

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

getChildrenNames

public java.util.Set getChildrenNames(Fqn fqn)
                               throws CacheException
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
CacheException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

printDetails

public java.lang.String printDetails()

printLockInfo

public java.lang.String printLockInfo()

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 members,
                                        java.lang.reflect.Method method,
                                        java.lang.Object[] args,
                                        boolean synchronous,
                                        boolean exclude_self,
                                        long timeout)
                                 throws java.lang.Exception
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
java.lang.Exception

_put

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

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

_put

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

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

_put

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

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

_put

public java.lang.Object _put(GlobalTransaction tx,
                             java.lang.String fqn,
                             java.lang.Object key,
                             java.lang.Object value,
                             boolean create_undo_ops)
                      throws CacheException
CacheException

_put

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

_remove

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

_remove

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

_remove

public java.lang.Object _remove(GlobalTransaction tx,
                                java.lang.String fqn,
                                java.lang.Object key,
                                boolean create_undo_ops)
                         throws CacheException
CacheException

_remove

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

setNodeLockingScheme

public void setNodeLockingScheme(java.lang.String nodeLockingScheme)

getNodeLockingScheme

public java.lang.String getNodeLockingScheme()

activateRegion

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

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

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

inactivateRegion

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

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

isInactiveOnStartup

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

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


setInactiveOnStartup

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

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



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