// Looking for LockPack in host. // Create one if necessary. private LockPack lookforLock(Component host_, Object o_) { LockPack p_ = null; // if (host_.locks != null) { // p_ = (LockPack)host_.locks; // while (p_ != null && p_.target != o_) p_ = p_.next; // } // if (p_ == null) { // First time the object is locked. // Search again in the synchronized claus to avoid racing. // Create one if it is still not there. synchronized (host_) { if (host_.locks != null) { p_ = (LockPack) host_.locks; while (p_ != null && p_.target != o_) p_ = p_.next; } if (p_ == null) { p_ = new LockPack(o_); p_.next = (LockPack) host_.locks; host_.locks = p_; } } // } return p_; }