neils-dev commented on PR #3781:
URL: https://github.com/apache/ozone/pull/3781#issuecomment-1295050426

   > Why use `threadLocal` variables in the latest patch? Does this even work?
   
   With the changes to the collecting the metrics in the 
`DatanodeAdminMonitorImpl` with on each iteration clearing the Map and then 
updating the container state for each active node in the workflow, it triggered 
synchronization (blocked) warnings (findbugs) due to setting the global Maps 
and counters in the scheduled monitor threads.  To resolve this, with the 
thread having its own thread context there is no conflict.  Maybe I've 
misunderstood its behavior here, 
   
   > If another thread reads the values set by the monitor thread, does it even 
get the values, as they should be local to the thread who set them?
   
   The monitor is the only thread setting the values and writing to the 
metrics.  Each run of the monitor thread has its own context through 
threadlocal variables.  Is this a problem?  I can revert the threadlocal 
changes easily, however we will be seeing the synchronized block problems when 
setting the individual counters in the `DatanodeAdminMonitorImpl` such as for 
the `pipelinesWaitingToClose`  .


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to