|
WeakHashMap uses weak *keys*.
This means that as long as there is *some* hard reference that points
to the key, it(the Map.Entry) will stay around.
The values in utilCacheTable are *hard* references to UtilCache
instances. Each instance maintains a hard-reference to it's name.
This name is then used as the key in utilCacheTable.
So, utilCacheTable will be able to grow without bounds.
Note, this problem is not a huge one, as the individual UtilCache
instances have different handling over their key/value pairs.
Additionally, access to utilCacheTable is not protected with a
synchronized block, or any other kind of locking. This could cause
odd problems to occur, very seldomly, due to other code creating
dynamic caches on demand(entity engine creates a unique cache for each
entity, one for pk lookups, and one for lists).
|