Methods Summary |
---|
public synchronized java.lang.Object | get(java.lang.Object key)Get an entry from this hashtable, and if we don't find anything,
defer to our parent, if any.
Object ret = super.get(key);
if ((ret == null) && (parent != null)) {
ret = parent.get(key);
}
return ret;
|
public java.util.Set | getAllKeys()Returns the keys in this hashtable, and its parent chain
HashSet set = new HashSet();
set.addAll(super.keySet());
Hashtable p = parent;
while (p != null) {
set.addAll(p.keySet());
if (p instanceof LockableHashtable) {
p = ((LockableHashtable) p).getParent();
} else {
p = null;
}
}
return set;
|
public synchronized java.util.Hashtable | getParent()Gets the parent Hashtable for this object (if any)
return parent;
|
public boolean | isKeyLocked(java.lang.Object key)Returns true if a given key is in our locked list
return lockedEntries != null && lockedEntries.contains(key);
|
public synchronized java.lang.Object | put(java.lang.Object p1, java.lang.Object p2)Overrides the Hashtable.put() method to mark items as not being locked.
return put(p1, p2, false);
|
public synchronized java.lang.Object | put(java.lang.Object p1, java.lang.Object p2, boolean locked)New version of the put() method that allows for explicitly marking
items added to the hashtable as locked.
if (lockedEntries != null &&
this.containsKey(p1) &&
lockedEntries.contains(p1)) {
return null;
}
if (locked) {
if (lockedEntries == null) {
lockedEntries = new Vector();
}
lockedEntries.add(p1);
}
return super.put(p1, p2);
|
public synchronized java.lang.Object | remove(java.lang.Object p1)Checks to see if an item is locked before it is removed.
if (lockedEntries != null && lockedEntries.contains(p1)) {
return null;
}
return super.remove(p1);
|
public synchronized void | setParent(java.util.Hashtable parent)Set the parent Hashtable for this object
this.parent = parent;
|