When I run the toPOJO method from the InfluxDBResultMapper in a multithreaded environment, some fields of the objects returned are null in some special cases.
Then I debugged and figured out that there is some problem in the cacheMeasurementClass method. When the first thread puts the measurement class into the cache map CLASS_FIELD_CACHE and before it finish putting all the field of the measurement class into cache, other threads would get an incomplete cache object.
I think it‘s better to make it synchronized or move the step of putting the measurement class into the cache map to the end, at least after all the field of the measurement class cached.
When I run the
toPOJOmethod from theInfluxDBResultMapperin a multithreaded environment, some fields of the objects returned are null in some special cases.Then I debugged and figured out that there is some problem in the
cacheMeasurementClassmethod. When the first thread puts the measurement class into the cache mapCLASS_FIELD_CACHEand before it finish putting all the field of the measurement class into cache, other threads would get an incomplete cache object.I think it‘s better to make it synchronized or move the step of putting the measurement class into the cache map to the end, at least after all the field of the measurement class cached.