Just wanted to throw this out to see if I'm overlooking something..
I noticed that the methods for getting and setting root fields both use
WRITE locks (see psuedocode below):
public class Root {
Object root;
Object rootGetter() {
if (root == null) {
DSOLock("Root.root", WRITE); // <-- XXX: is READ okay here?
try {
root = RESOLVE_ROOT("Root.root");
} finally {
DSOUnlock("Root.root");
}
}
return root;
}
void rootSetter(Object root) {
if (root != null) {
DSOLock("Root.root", WRITE);
try {
LOOKUP_OR_CREATE_ROOT("Root.root", root);
} finally {
DSOUnlock("Root.root");
}
}
}
}
I'm wondering it makes sense to use a READ lock for the root getter? For
regular non-primitive roots this will only help the case when reading
roots with null values (which presently means never initialized). For
primitive roots, the situation is a little worse in that we do get the
WRITE lock on every read since we don't have a magic null marker for
primitives.
-tim
_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev