Ok. Good comments. Question is how to proceed.

I can leave out the constructorCacheMap (the one with classloader as key).

But there are other options; I could wrap classloader in a weakref and have the entry removed from the map once the classloader is garbage collected.

Another option is do touch the map entries when the classloader is used and if the timestamp is too old, then the map entry is kicked out.