{
DataNode parent = root;
DataNode child = null;
Object owner = getOwnerForLock();
Object name = null;
NodeFactory factory = NodeFactory.getInstance();
byte type = isNodeLockingOptimistic()
? NodeFactory.NODE_TYPE_OPTIMISTIC_NODE
: NodeFactory.NODE_TYPE_TREENODE;
for (int i = 0; i < subtree.size(); i++)
{
name = subtree.get(i);
child = (DataNode) parent.getChild(name);
if (child == null)
{
// Lock the parent, create and add the child
try
{
parent.acquire(owner, state_fetch_timeout, DataNode.LOCK_TYPE_WRITE);
}
catch (InterruptedException e)
{
log.error("Interrupted while locking" + parent.getFqn(), e);
throw new CacheException(e.getLocalizedMessage(), e);
}
try
{
child = factory.createDataNode(type, name,
subtree.getFqnChild(i + 1),
parent, null, this);
// Add uninitialized flag so that data stored at the root of the
// region can be loaded/preloaded from the cache loader.
child.put(UNINITIALIZED, null);