Netflix / archaius

Library for configuration management API
Apache License 2.0
2.46k stars 485 forks source link

Fix race condition on propertyUsageMap via AtomicReference #699

Closed akang31 closed 7 months ago

akang31 commented 8 months ago

Address the race condition on propertyUsageMap when we are trying to flush the existing map and then empty it. We use the AtomicReference here to hot swap the existing map out for a new empty one before we then copy the old map to be flushed.

Also tacked on a small logging change here, which flips the logging to only happen when it starts up the flushing and doesn't print at all when nothing is flushing. SBN by default will setup the AccessMonitorUtil twice, so we just add confusing noise for no reason with the prior logs.