Skip to content
Commit d0292f05 authored by Jason Tedor's avatar Jason Tedor Committed by GitHub
Browse files

Lazy initialize deprecation logger in parser

The deprecation logger in AbstractXContentParser is static. This is done
for performance reasons, to avoid constructing a deprecation logger for
every parser of which there can be many (e.g., one for every document
when scripting). This is fine, but the static here is a problem because
it means we touch loggers before logging is initialized (when
constructing a list setting in Environment which is a precursor to
initializing logging). Therefore, to maintain the previous change (not
constructing a parser for every instance) but avoiding the problems with
static, we have to lazy initialize here. This is not perfect, there is a
volatile read behind the scenes. This could be avoided (e.g., by not
using set once) but I prefer the safety that set once provides. I think
this should be the approach unless it otherwise proves problematic.

Relates #26210 
parent 54620ffc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment