hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [hadoop] branch trunk updated: YARN-9327. Improve synchronisation in ProtoUtils#convertToProtoFormat block. Contributed by Bibin A Chundatt.
Date Tue, 02 Jul 2019 06:44:09 GMT
This is an automated email from the ASF dual-hosted git repository.

sunilg pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 0c8813f  YARN-9327. Improve synchronisation in ProtoUtils#convertToProtoFormat block.
Contributed by Bibin A Chundatt.
0c8813f is described below

commit 0c8813f135f8c17f88660bb92529c15bb3a157ca
Author: Sunil G <sunilg@apache.org>
AuthorDate: Tue Jul 2 11:44:11 2019 +0530

    YARN-9327. Improve synchronisation in ProtoUtils#convertToProtoFormat block. Contributed
by Bibin A Chundatt.
---
 .../java/org/apache/hadoop/yarn/api/records/impl/pb/ProtoUtils.java | 2 +-
 .../org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ProtoUtils.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ProtoUtils.java
index 3f360d7..64b49c8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ProtoUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ProtoUtils.java
@@ -412,7 +412,7 @@ public class ProtoUtils {
   /*
    * Resource
    */
-  public static synchronized ResourceProto convertToProtoFormat(Resource r) {
+  public static ResourceProto convertToProtoFormat(Resource r) {
     return ResourcePBImpl.getProto(r);
   }
 
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java
index 36fc959..ed9f3db 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java
@@ -75,14 +75,14 @@ public class ResourcePBImpl extends Resource {
     initResources();
   }
 
-  public ResourceProto getProto() {
+  synchronized public ResourceProto getProto() {
     mergeLocalToProto();
     proto = viaProto ? proto : builder.build();
     viaProto = true;
     return proto;
   }
 
-  private void maybeInitBuilder() {
+  synchronized private void maybeInitBuilder() {
     if (viaProto || builder == null) {
       builder = ResourceProto.newBuilder(proto);
     }
@@ -131,7 +131,7 @@ public class ResourcePBImpl extends Resource {
     resources[VCORES_INDEX].setValue(vCores);
   }
 
-  private void initResources() {
+  synchronized private void initResources() {
     if (this.resources != null) {
       return;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message