Browse Source

HDFS-16099. Make bpServiceToActive to be volatile. (#3159)

Co-authored-by: zhangshuyan <zqingchai@gmail.com>
zhangshuyan0 3 years ago
parent
commit
9be17339eb

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPOfferService.java

@@ -81,7 +81,7 @@ class BPOfferService {
    * this can be null. If non-null, this must always refer to a member
    * of the {@link #bpServices} list.
    */
-  private BPServiceActor bpServiceToActive = null;
+  private volatile BPServiceActor bpServiceToActive = null;
   
   /**
    * The list of all actors for namenodes in this nameservice, regardless