Do not set write locks when adding a node or setting a node to a
transient parent.
This commit is contained in:
parent
7a95ff731b
commit
be1dd61a19
1 changed files with 23 additions and 16 deletions
|
@ -743,10 +743,13 @@ public final class Node implements INode, Serializable {
|
|||
else
|
||||
throw new RuntimeException ("Can't add fixed-transient node to a persistent node");
|
||||
|
||||
// only lock node if it has to be modified for a change in subnodes
|
||||
// only lock nodes if parent node is not transient
|
||||
if (state != TRANSIENT) {
|
||||
// only lock parent if it has to be modified for a change in subnodes
|
||||
if (!ignoreSubnodeChange ())
|
||||
checkWriteLock ();
|
||||
node.checkWriteLock ();
|
||||
}
|
||||
|
||||
// if subnodes are defined via realation, make sure its constraints are enforced.
|
||||
if (dbmap != null && dbmap.getSubnodeRelation () != null)
|
||||
|
@ -1640,6 +1643,7 @@ public final class Node implements INode, Serializable {
|
|||
throw new RuntimeException ("Can't set "+propname+" to object with prototype "+value.getPrototype()+", was expecting "+nmap.getTypeName());
|
||||
}
|
||||
|
||||
if (state != TRANSIENT)
|
||||
checkWriteLock ();
|
||||
|
||||
Node n = null;
|
||||
|
@ -1652,6 +1656,7 @@ public final class Node implements INode, Serializable {
|
|||
if (state != TRANSIENT && n.state == TRANSIENT)
|
||||
n.makePersistentCapable ();
|
||||
|
||||
if (state != TRANSIENT)
|
||||
n.checkWriteLock ();
|
||||
|
||||
// check if the main identity of this node is as a named property
|
||||
|
@ -1700,10 +1705,12 @@ public final class Node implements INode, Serializable {
|
|||
// this is done anyway when the node becomes persistent.
|
||||
if (n.state != TRANSIENT) {
|
||||
// check node in with transactor cache
|
||||
String nID = n.getID();
|
||||
DbMapping dbm = n.getDbMapping ();
|
||||
// String nID = n.getID();
|
||||
// DbMapping dbm = n.getDbMapping ();
|
||||
Transactor tx = (Transactor) Thread.currentThread ();
|
||||
tx.visitCleanNode (new DbKey (dbm, nID), n);
|
||||
// tx.visitCleanNode (new DbKey (dbm, nID), n);
|
||||
// UPDATE: using n.getKey() instead of manually constructing key. HW 2002/09/13
|
||||
tx.visitCleanNode (n.getKey(), n);
|
||||
// if the field is not the primary key of the property, also register it
|
||||
if (rel != null && rel.accessor != null && state != TRANSIENT) {
|
||||
Key secKey = new SyntheticKey (getKey (), propname);
|
||||
|
|
Loading…
Add table
Reference in a new issue