saxenapranav commented on code in PR #6314:
URL: https://github.com/apache/hadoop/pull/6314#discussion_r1440069408
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsCountersImpl.java:
##########
@@ -63,6 +67,12 @@ public class AbfsCountersImpl implements AbfsCounters {
private final IOStatisticsStore ioStatisticsStore;
+ private AtomicReference<AbfsBackoffMetrics> abfsBackoffMetrics = null;
+
+ private AtomicReference<AbfsReadFooterMetrics> abfsReadFooterMetrics = null;
Review Comment:
For outside world, they will call `getAbfsReadFooterMetrics` which does a
getter on the wrapper. This is an O(1) operation, just a getter. So, after
getting the object, any thread having this object in reference, can call any
method in the object and increment / decrement the value.
For ex, let take two threads t1 and t2 :
```
t1 = new Thread(() -> {
AbfsReadFooterMetrics met = getAbfsReadFooterMetrics(); // l1
met.callAnyMethod1() // l2
met.callAnyMethod2() // l3
}).start;
t1 = new Thread(() -> {
AbfsReadFooterMetrics met = getAbfsReadFooterMetrics(); // l4
met.callAnyMethod1() // l5
met.callAnyMethod2() // l6
}).start;
```
Here, l4 and l1 can be sequential. But, nothing can stop the interleaving
between l2, l3, l5, l6.
This is the reason, I am suggesting that having it in an atomicReference is
of not much importance, but we should have a synchronized block in which all
parameters are changed.
Same goes for other new added atomicReferences.
--
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]