I would like to make some request-wide data available in my app engine application.
Examples:
I see that ThreadLocal
is on GAE's JRE whitelist.
Is ThreadLocal
a good and safe way to make this information available? Are there alternative / better / more accepted ways?
Yes, it is an accepted practice to store these things in a ThreadLocal
. However, a more preferable approach is to pass these values around (as method arguments) wherever they are needed, instead of reaching for them. It's more preferable, because it's more testable at least.