org.jboss.cache
Class Node

java.lang.Object
  extended by org.jboss.cache.AbstractNode
      extended by org.jboss.cache.Node
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, DataNode, TreeNode
Direct Known Subclasses:
OptimisticTreeNode

public class Node
extends AbstractNode
implements java.io.Externalizable

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jboss.cache.AbstractNode
children, data, fqn, INDENT, name, parent
 
Fields inherited from interface org.jboss.cache.DataNode
LOCK_TYPE_NONE, LOCK_TYPE_READ, LOCK_TYPE_WRITE, PRINT_LOCK_DETAILS
 
Constructor Summary
Node()
           
Node(java.lang.Object child_name, Fqn fqn, Node parent, java.util.Map data, boolean mapSafe, TreeCache cache)
           
Node(java.lang.Object child_name, Fqn fqn, Node parent, java.util.Map data, TreeCache cache)
           
Node(java.lang.Object child_name, Fqn fqn, Node parent, java.lang.Object key, java.lang.Object value, TreeCache cache)
           
 
Method Summary
 boolean acquire(java.lang.Object caller, long timeout, int lock_type)
           
 java.util.Set acquireAll(java.lang.Object caller, long timeout, int lock_type)
          Not to be exposed.
protected  boolean acquireReadLock(java.lang.Object caller, long timeout)
           
protected  boolean acquireWriteLock(java.lang.Object caller, long timeout)
           
protected  java.util.Map children()
          Override this if concurrent thread access may occur.
 void clear()
           
 java.lang.Object clone()
           
 boolean containsKey(java.lang.Object key)
           
 TreeNode createChild(java.lang.Object child_name, Fqn fqn, TreeNode parent)
           
 TreeNode createChild(java.lang.Object child_name, Fqn fqn, TreeNode parent, java.lang.Object key, java.lang.Object value)
           
 java.lang.Object get(java.lang.Object key)
           
 boolean getChildrenLoaded()
          Not to be exposed.
 java.util.Map getData()
          Returns a copy of the attributes.
 java.util.Set getDataKeys()
           
 IdentityLock getImmutableLock()
          Deprecated. Use getLock() instead
 IdentityLock getLock()
          Not to be exposed.
 TreeNode getOrCreateChild(java.lang.Object child_name, GlobalTransaction gtx, boolean createIfNotExists)
          Creates a new child of this node if it doesn't exist.
 TreeNode getParent()
           
protected  void init()
           
protected  void init(java.lang.Object child_name, Fqn fqn, Node parent, TreeCache cache)
           
 boolean isLocked()
          Not to be exposed.
 int numAttributes()
           
 void printDetails(java.lang.StringBuffer sb, int indent)
           
 void printLockInfo(java.lang.StringBuffer sb, int indent)
          Not to be exposed.
 void put(java.util.Map data, boolean erase)
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void readExternal(java.io.ObjectInput in)
           
 void release(java.lang.Object caller)
          Not to be exposed.
 void releaseAll(java.lang.Object owner)
          Not to be exposed.
 void releaseAllForce()
          Not to be exposed.
 void releaseForce()
          Not to be exposed.
 java.lang.Object remove(java.lang.Object key)
           
 void setChildrenLoaded(boolean flag)
          Not to be exposed.
 void setRecursiveTreeCacheInstance(TreeCache cache)
          Set the tree cache instance recursively down to the children as well.
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class org.jboss.cache.AbstractNode
addChild, childExists, data, getChild, getChildren, getFqn, getName, hasChildren, print, printDetailsInMap, printIndent, put, removeAllChildren, removeChild, setChildren
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node()

Node

public Node(java.lang.Object child_name,
            Fqn fqn,
            Node parent,
            java.util.Map data,
            TreeCache cache)
Parameters:
child_name -
fqn -
parent -
data -
cache -

Node

public Node(java.lang.Object child_name,
            Fqn fqn,
            Node parent,
            java.util.Map data,
            boolean mapSafe,
            TreeCache cache)
Parameters:
child_name -
fqn -
parent -
data -
mapSafe - true if param data can safely be directly assigned to this object's AbstractNode.data field; false if param data's contents should be copied into this object's AbstractNode.data field.
cache -

Node

public Node(java.lang.Object child_name,
            Fqn fqn,
            Node parent,
            java.lang.Object key,
            java.lang.Object value,
            TreeCache cache)
Parameters:
child_name -
fqn -
parent -
key -
value -
cache -
Method Detail

init

protected final void init(java.lang.Object child_name,
                          Fqn fqn,
                          Node parent,
                          TreeCache cache)

getParent

public TreeNode getParent()
Specified by:
getParent in interface TreeNode
Overrides:
getParent in class AbstractNode

init

protected void init()

children

protected java.util.Map children()
Description copied from class: AbstractNode
Override this if concurrent thread access may occur.

Overrides:
children in class AbstractNode

setRecursiveTreeCacheInstance

public void setRecursiveTreeCacheInstance(TreeCache cache)
Set the tree cache instance recursively down to the children as well. Note that this method is not currently thread safe.

Specified by:
setRecursiveTreeCacheInstance in interface DataNode
Specified by:
setRecursiveTreeCacheInstance in interface TreeNode
Parameters:
cache -
See Also:
DataNode

getChildrenLoaded

public boolean getChildrenLoaded()
Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
getChildrenLoaded in interface DataNode
Specified by:
getChildrenLoaded in interface TreeNode
See Also:
DataNode

setChildrenLoaded

public void setChildrenLoaded(boolean flag)
Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
setChildrenLoaded in interface DataNode
Specified by:
setChildrenLoaded in interface TreeNode
See Also:
DataNode

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface TreeNode

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface TreeNode
See Also:
DataNode

getDataKeys

public java.util.Set getDataKeys()
Specified by:
getDataKeys in interface TreeNode
See Also:
DataNode

isLocked

public boolean isLocked()
Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
isLocked in interface DataNode
Specified by:
isLocked in interface TreeNode
See Also:
DataNode

getImmutableLock

public IdentityLock getImmutableLock()
Deprecated. Use getLock() instead

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
getImmutableLock in interface TreeNode
See Also:
DataNode

getLock

public IdentityLock getLock()
Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
getLock in interface DataNode
Specified by:
getLock in interface TreeNode
See Also:
DataNode

getData

public java.util.Map getData()
Description copied from interface: TreeNode
Returns a copy of the attributes. Use get(Object key) instead.

Specified by:
getData in interface DataNode
Specified by:
getData in interface TreeNode
See Also:
DataNode

numAttributes

public int numAttributes()
Specified by:
numAttributes in interface TreeNode
See Also:
DataNode

put

public void put(java.util.Map data,
                boolean erase)
Specified by:
put in interface TreeNode

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface TreeNode

getOrCreateChild

public TreeNode getOrCreateChild(java.lang.Object child_name,
                                 GlobalTransaction gtx,
                                 boolean createIfNotExists)
Description copied from interface: DataNode
Creates a new child of this node if it doesn't exist. Also notifies the cache that the new child has been created. Added this new getOrCreateChild() method to avoid thread contention on create_lock in PessimisticLockInterceptor.lock()

Specified by:
getOrCreateChild in interface DataNode
Specified by:
getOrCreateChild in interface TreeNode
See Also:
DataNode

createChild

public TreeNode createChild(java.lang.Object child_name,
                            Fqn fqn,
                            TreeNode parent)
Specified by:
createChild in interface TreeNode

createChild

public TreeNode createChild(java.lang.Object child_name,
                            Fqn fqn,
                            TreeNode parent,
                            java.lang.Object key,
                            java.lang.Object value)
Specified by:
createChild in interface TreeNode
See Also:
DataNode

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface TreeNode

clear

public void clear()
Specified by:
clear in interface TreeNode

printDetails

public void printDetails(java.lang.StringBuffer sb,
                         int indent)
Specified by:
printDetails in interface DataNode
Specified by:
printDetails in interface TreeNode

printLockInfo

public void printLockInfo(java.lang.StringBuffer sb,
                          int indent)
Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
printLockInfo in interface DataNode
Specified by:
printLockInfo in interface TreeNode
See Also:
DataNode

toString

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

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface DataNode
Specified by:
clone in class AbstractNode
Throws:
java.lang.CloneNotSupportedException

acquire

public boolean acquire(java.lang.Object caller,
                       long timeout,
                       int lock_type)
                throws LockingException,
                       TimeoutException,
                       java.lang.InterruptedException
Specified by:
acquire in interface DataNode
Throws:
LockingException
TimeoutException
java.lang.InterruptedException

acquireReadLock

protected boolean acquireReadLock(java.lang.Object caller,
                                  long timeout)
                           throws LockingException,
                                  TimeoutException,
                                  java.lang.InterruptedException
Throws:
LockingException
TimeoutException
java.lang.InterruptedException

acquireWriteLock

protected boolean acquireWriteLock(java.lang.Object caller,
                                   long timeout)
                            throws LockingException,
                                   TimeoutException,
                                   java.lang.InterruptedException
Throws:
LockingException
TimeoutException
java.lang.InterruptedException

acquireAll

public java.util.Set acquireAll(java.lang.Object caller,
                                long timeout,
                                int lock_type)
                         throws LockingException,
                                TimeoutException,
                                java.lang.InterruptedException
Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
acquireAll in interface DataNode
Specified by:
acquireAll in interface TreeNode
Throws:
LockingException
TimeoutException
java.lang.InterruptedException
See Also:
DataNode

release

public void release(java.lang.Object caller)
Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
release in interface TreeNode
See Also:
DataNode

releaseForce

public void releaseForce()
Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
releaseForce in interface TreeNode
See Also:
DataNode

releaseAll

public void releaseAll(java.lang.Object owner)
Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
releaseAll in interface DataNode
Specified by:
releaseAll in interface TreeNode
See Also:
DataNode

releaseAllForce

public void releaseAllForce()
Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
releaseAllForce in interface DataNode
Specified by:
releaseAllForce in interface TreeNode
See Also:
DataNode

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException


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