if (!(plainLock instanceof RecordHandle)) {
// only interested in rows locks
continue;
}
ContainerKey ckey = ((RecordHandle) plainLock).getContainerId();
LockCount lc = (LockCount) containers.get(ckey);
if (lc == null) {
lc = new LockCount();
containers.put(ckey, lc);
}
lc.count++;
}
// Determine the threshold for lock escalation
// based upon our own limit, not the current count
int threshold = limit / (containers.size() + 1);
if (threshold < (limit / 4))
threshold = limit / 4;
// try to table lock all tables that are above
// this threshold
boolean didEscalate = false;
for (Enumeration<ContainerKey> e = containers.keys(); e.hasMoreElements(); ) {
ContainerKey ckey = e.nextElement();
LockCount lc = containers.get(ckey);
if (lc.count < threshold) {
continue;