> [...] you could cache the results of the reflection
> (really it is the whole "parsing" algorithm, which
> uses reflection) globally for each class, so it
> re-uses the same generated "algorithm" whenever it
> sees the same class.

Please make sure that the class objects don't get strongly
linked to from the cache.
This is surprisingly hard to get right actually. I once
tried to do something like that, and found that garbage
collection and weak references and WeakHashMaps somehow
do something subtly different than I had thought. In the
end, I punted and declared Introspector "barely sufficient
for the use case at hand".

Since caching reflection is easy to get wrong, if Jooq is
ever going to use that, the hard-to-get-right aspects of
this should be solved by Jooq. Could be done by
- having (or linking to) a full in-depth description
  how to do it right,
- offering a reflection cache data structure that does it
  right,
- make Jooq's API accept the reflection info, but manage
  the cache inside Jooq (and say in the Javadoc that the
  code computing that reflection info must never retain
  any references to that info).

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to