diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java index a6abb99b43..4c5fee0e7f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java @@ -65,7 +65,7 @@ public GetApplicationsRequestPBImpl(GetApplicationsRequestProto proto) { viaProto = true; } - public GetApplicationsRequestProto getProto() { + public synchronized GetApplicationsRequestProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; @@ -175,13 +175,13 @@ private void initQueues() { } @Override - public Set getApplicationTypes() { + public synchronized Set getApplicationTypes() { initApplicationTypes(); return this.applicationTypes; } @Override - public void setApplicationTypes(Set applicationTypes) { + public synchronized void setApplicationTypes(Set applicationTypes) { maybeInitBuilder(); if (applicationTypes == null) builder.clearApplicationTypes(); @@ -198,13 +198,13 @@ private void initApplicationTags() { } @Override - public Set getApplicationTags() { + public synchronized Set getApplicationTags() { initApplicationTags(); return this.applicationTags; } @Override - public void setApplicationTags(Set tags) { + public synchronized void setApplicationTags(Set tags) { maybeInitBuilder(); if (tags == null || tags.isEmpty()) { builder.clearApplicationTags(); @@ -219,7 +219,7 @@ public void setApplicationTags(Set tags) { } @Override - public EnumSet getApplicationStates() { + public synchronized EnumSet getApplicationStates() { initApplicationStates(); return this.applicationStates; } @@ -233,12 +233,12 @@ private void initScope() { } @Override - public ApplicationsRequestScope getScope() { + public synchronized ApplicationsRequestScope getScope() { initScope(); return this.scope; } - public void setScope(ApplicationsRequestScope scope) { + public synchronized void setScope(ApplicationsRequestScope scope) { maybeInitBuilder(); if (scope == null) { builder.clearScope(); @@ -247,7 +247,7 @@ public void setScope(ApplicationsRequestScope scope) { } @Override - public void setApplicationStates(EnumSet applicationStates) { + public synchronized void setApplicationStates(EnumSet applicationStates) { maybeInitBuilder(); if (applicationStates == null) { builder.clearApplicationStates(); @@ -256,7 +256,7 @@ public void setApplicationStates(EnumSet applicationStates } @Override - public void setApplicationStates(Set applicationStates) { + public synchronized void setApplicationStates(Set applicationStates) { EnumSet appStates = null; for (YarnApplicationState state : YarnApplicationState.values()) { if (applicationStates.contains( @@ -272,12 +272,12 @@ public void setApplicationStates(Set applicationStates) { } @Override - public Set getUsers() { + public synchronized Set getUsers() { initUsers(); return this.users; } - public void setUsers(Set users) { + public synchronized void setUsers(Set users) { maybeInitBuilder(); if (users == null) { builder.clearUsers(); @@ -286,13 +286,13 @@ public void setUsers(Set users) { } @Override - public Set getQueues() { + public synchronized Set getQueues() { initQueues(); return this.queues; } @Override - public void setQueues(Set queues) { + public synchronized void setQueues(Set queues) { maybeInitBuilder(); if (queues == null) { builder.clearQueues(); @@ -301,7 +301,7 @@ public void setQueues(Set queues) { } @Override - public long getLimit() { + public synchronized long getLimit() { if (this.limit == Long.MAX_VALUE) { GetApplicationsRequestProtoOrBuilder p = viaProto ? proto : builder; this.limit = p.hasLimit() ? p.getLimit() : Long.MAX_VALUE; @@ -310,13 +310,13 @@ public long getLimit() { } @Override - public void setLimit(long limit) { + public synchronized void setLimit(long limit) { maybeInitBuilder(); this.limit = limit; } @Override - public Range getStartRange() { + public synchronized Range getStartRange() { if (this.start == null) { GetApplicationsRequestProtoOrBuilder p = viaProto ? proto: builder; if (p.hasStartBegin() || p.hasStartEnd()) { @@ -329,12 +329,12 @@ public Range getStartRange() { } @Override - public void setStartRange(Range range) { + public synchronized void setStartRange(Range range) { this.start = range; } @Override - public void setStartRange(long begin, long end) + public synchronized void setStartRange(long begin, long end) throws IllegalArgumentException { if (begin > end) { throw new IllegalArgumentException("begin > end in range (begin, " + @@ -344,7 +344,7 @@ public void setStartRange(long begin, long end) } @Override - public Range getFinishRange() { + public synchronized Range getFinishRange() { if (this.finish == null) { GetApplicationsRequestProtoOrBuilder p = viaProto ? proto: builder; if (p.hasFinishBegin() || p.hasFinishEnd()) { @@ -357,12 +357,12 @@ public Range getFinishRange() { } @Override - public void setFinishRange(Range range) { + public synchronized void setFinishRange(Range range) { this.finish = range; } @Override - public void setFinishRange(long begin, long end) { + public synchronized void setFinishRange(long begin, long end) { if (begin > end) { throw new IllegalArgumentException("begin > end in range (begin, " + "end): (" + begin + ", " + end + ")");