Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.cache
Class Node

    java.lang.Object
      org.jboss.cache.Node

All Implemented Interfaces:
  Externalizable, Serializable

public class Node
extends Object
implements Externalizable

Represents a node in the tree. Has a relative name and a Fqn. Maintains a hashmap. If the node is created in a replicated cache, the relative and fully qualified name, and the keys and values of the hashmap have to be serializable.

Note that current version supports different levels of transaction locking such as simple locking (`TreeCache.SERIALIZABLE`, or R/W lock with upgrade ( `REPEATABLE_READ`) --that is the read lock will be automatically upgraded to write lock when the same owner intends to modify the data after read.

Version:
  $Revision: 1.39.2.1 $
Author:
  Bela Ban March 25 2003, Ben Wang
See Also:
  Serialized Form

Field Summary
`protected static int` | `INDENT`
`static int` | `LOCK_TYPE_READ` Declare locking type with the intention to read or write data
`static int` | `LOCK_TYPE_WRITE`

Constructor Summary
`Node()`
`Node(Object child_name, Fqn fqn, Node parent, Map data, TreeCache cache)`
`Node(Object child_name, Fqn fqn, Node parent, Object key, Object value, TreeCache cache)`
`Node(TreeCache cache)`

Method Summary
`boolean` | `acquire(Object owner, long timeout, int lock_type)` Acquire a node object by locking it first.
`protected void` | `acquireAll(Object owner, long timeout, int lock_type)` Acquires locks for the entire subtree
`protected boolean` | `acquireReadLock(Object owner, long timeout)`
`protected boolean` | `acquireWriteLock(Object owner, long timeout)`
`boolean` | `childExists(Object child_name)`
`void` | `clear()`
`Object` | `clone()`
`boolean` | `containsKey(Object key)`
`Node` | `createChild(Object child_name, Fqn fqn, Node parent)`
`Node` | `createChild(Object child_name, Fqn fqn, Node parent, Map data)`
`Node` | `createChild(Object child_name, Fqn fqn, Node parent, Object key, Object value)`
`Object` | `get(Object key)`
`Node` | `getChild(Object child_name)`
`Map` | `getChildren()`
`Map` | `getData()`
`Set` | `getDataKeys()`
`Fqn` | `getFqn()`
`IdentityLock` | `getImmutableLock()`
`Object` | `getName()`
`Node` | `getParent()`
`boolean` | `hasChild()` Deprecated. Use `hasChildren()` instead
`boolean` | `hasChildren()`
`protected void` | `init()`
`protected void` | `init(Object child_name, Fqn fqn, Node parent, TreeCache cache)`
`int` | `numAttributes()`
`void` | `print(StringBuffer sb, int indent)`
`void` | `printDetails(StringBuffer sb, int indent)`
`void` | `printIndent(StringBuffer sb, int indent)`
`void` | `printLockInfo(StringBuffer sb, int indent)`
`void` | `put(Map data)`
`void` | `put(Map data, boolean erase)`
`Object` | `put(Object key, Object value)`
`void` | `readExternal(ObjectInput in)`
`void` | `release(Object owner)`
`protected void` | `releaseAll(Object owner)` Releases locks for the entire subtree
`protected void` | `releaseAllForce()` Releases locks for the entire subtree.
`protected void` | `releaseForce()`
`Object` | `remove(Object key)`
`void` | `removeAllChildren()`
`void` | `removeChild(Object child_name)`
`String` | `toString()`
`void` | `writeExternal(ObjectOutput out)`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### LOCK_TYPE_READ

    public static final int LOCK_TYPE_READ

  Declare locking type with the intention to read or write data

  See Also:
    Constant Field Values

### LOCK_TYPE_WRITE

    public static final int LOCK_TYPE_WRITE

See Also:
  Constant Field Values

### INDENT

    protected static final int INDENT

See Also:
  Constant Field Values

Constructor Detail

### Node

    public Node()

### Node

    public Node(TreeCache cache)

### Node

    public Node(Object child_name,
                Fqn fqn,
                Node parent,
                Map data,
                TreeCache cache)

### Node

    public Node(Object child_name,
                Fqn fqn,
                Node parent,
                Object key,
                Object value,
                TreeCache cache)

Method Detail

### init

    protected void init(Object child_name,
                        Fqn fqn,
                        Node parent,
                        TreeCache cache)

### init

    protected void init()

### getName

    public Object getName()

### getFqn

    public Fqn getFqn()

### get

    public Object get(Object key)

### containsKey

    public boolean containsKey(Object key)

### getChild

    public Node getChild(Object child_name)

### getParent

    public Node getParent()

### getDataKeys

    public Set getDataKeys()

### childExists

    public boolean childExists(Object child_name)

### getImmutableLock

    public IdentityLock getImmutableLock()

### getChildren

    public Map getChildren()

  Returns:
    Map

### getData

    public Map getData()

### numAttributes

    public int numAttributes()

### hasChild

    public boolean hasChild()

  Deprecated. Use `hasChildren()` instead

  Returns:

### hasChildren

    public boolean hasChildren()

### put

    public void put(Map data,
                    boolean erase)

### put

    public void put(Map data)

### put

    public Object put(Object key,
                      Object value)

### createChild

    public Node createChild(Object child_name,
                            Fqn fqn,
                            Node parent)

### createChild

    public Node createChild(Object child_name,
                            Fqn fqn,
                            Node parent,
                            Map data)

### createChild

    public Node createChild(Object child_name,
                            Fqn fqn,
                            Node parent,
                            Object key,
                            Object value)

### remove

    public Object remove(Object key)

### clear

    public void clear()

### removeChild

    public void removeChild(Object child_name)

### removeAllChildren

    public void removeAllChildren()

### print

    public void print(StringBuffer sb,
                      int indent)

### printDetails

    public void printDetails(StringBuffer sb,
                             int indent)

### printLockInfo

    public void printLockInfo(StringBuffer sb,
                              int indent)

### printIndent

    public void printIndent(StringBuffer sb,
                            int indent)

### toString

    public String toString()

### clone

    public Object clone()
                 throws CloneNotSupportedException

  Throws:
    `CloneNotSupportedException`

### acquire

    public boolean acquire(Object owner,
                           long timeout,
                           int lock_type)
                    throws LockingException,
                           TimeoutException

  Acquire a node object by locking it first. The lock type is specified via `lock_type`.

  Parameters:
    `owner` - Tansaction context owner.
    `timeout` - Timeout in milliseconds
    `lock_type` - @see Node
  Returns:
    boolean True if node could be acquired, false if owner already held the lock. An exception is thrown if the owner didn't already hold the lock, but it couldn't be acquired
  Throws:
    `LockingException`
    `TimeoutException`

### acquireReadLock

    protected boolean acquireReadLock(Object owner,
                                      long timeout)
                               throws LockingException,
                                      TimeoutException

  Throws:
    `LockingException`
    `TimeoutException`

### acquireWriteLock

    protected boolean acquireWriteLock(Object owner,
                                       long timeout)
                                throws LockingException,
                                       TimeoutException

  Throws:
    `LockingException`
    `TimeoutException`

### acquireAll

    protected void acquireAll(Object owner,
                              long timeout,
                              int lock_type)
                       throws LockingException,
                              TimeoutException

  Acquires locks for the entire subtree

  Throws:
    `LockingException`
    `TimeoutException`

### release

    public void release(Object owner)

### releaseForce

    protected void releaseForce()

### releaseAll

    protected void releaseAll(Object owner)

  Releases locks for the entire subtree

### releaseAllForce

    protected void releaseAllForce()

  Releases locks for the entire subtree. Forces release regardless of owner

### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

  Specified by:
    `writeExternal` in interface `Externalizable`
  Throws:
    `IOException`

### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

  Specified by:
    `readExternal` in interface `Externalizable`
  Throws:
    `IOException`
    `ClassNotFoundException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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