The use of ThreadLocal<T> in MediaEntityBuilder looks wrong and can cause race conditions. A ThreadLocal<T> object should be initialized once, and only its Value property should be set in order to change the value per thread. Re-setting the reference to the ThreadLocal<T> object itself replaces the existing values for all threads.
The use of
ThreadLocal<T>
inMediaEntityBuilder
looks wrong and can cause race conditions. AThreadLocal<T>
object should be initialized once, and only itsValue
property should be set in order to change the value per thread. Re-setting the reference to theThreadLocal<T>
object itself replaces the existing values for all threads.