Skip to content

Commit

Permalink
YARN-11236. Fix CheckStyle.
Browse files Browse the repository at this point in the history
  • Loading branch information
slfan1989 committed Aug 10, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 294f8b2 commit e005045
Showing 4 changed files with 23 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -328,11 +328,10 @@ public Version loadVersion() {
public AddReservationHomeSubClusterResponse addReservationHomeSubCluster(
AddReservationHomeSubClusterRequest request) throws YarnException {
FederationReservationHomeSubClusterStoreInputValidator.validate(request);
ReservationId reservationId =
request.getReservationHomeSubCluster().getReservationId();
ReservationHomeSubCluster homeSubCluster = request.getReservationHomeSubCluster();
ReservationId reservationId = homeSubCluster.getReservationId();
if (!reservations.containsKey(reservationId)) {
reservations.put(reservationId,
request.getReservationHomeSubCluster().getHomeSubCluster());
reservations.put(reservationId, homeSubCluster.getHomeSubCluster());
}
return AddReservationHomeSubClusterResponse.newInstance(reservations.get(reservationId));
}
@@ -346,8 +345,9 @@ public GetReservationHomeSubClusterResponse getReservationHomeSubCluster(
throw new YarnException("Reservation " + reservationId + " does not exist");
}
SubClusterId subClusterId = reservations.get(reservationId);
return GetReservationHomeSubClusterResponse.newInstance(
ReservationHomeSubCluster.newInstance(reservationId, subClusterId));
ReservationHomeSubCluster homeSubCluster =
ReservationHomeSubCluster.newInstance(reservationId, subClusterId);
return GetReservationHomeSubClusterResponse.newInstance(homeSubCluster);
}

@Override
@@ -356,10 +356,10 @@ public GetReservationsHomeSubClusterResponse getReservationsHomeSubCluster(
List<ReservationHomeSubCluster> result = new ArrayList<>();

for (Entry<ReservationId, SubClusterId> entry : reservations.entrySet()) {
ReservationId key = entry.getKey();
SubClusterId value = entry.getValue();
ReservationId reservationId = entry.getKey();
SubClusterId subClusterId = entry.getValue();
ReservationHomeSubCluster homeSubCluster =
ReservationHomeSubCluster.newInstance(key, value);
ReservationHomeSubCluster.newInstance(reservationId, subClusterId);
result.add(homeSubCluster);
}

Original file line number Diff line number Diff line change
@@ -46,8 +46,7 @@ public abstract class ReservationHomeSubCluster {
@Unstable
public static ReservationHomeSubCluster newInstance(ReservationId appId,
SubClusterId homeSubCluster) {
ReservationHomeSubCluster appMapping =
Records.newRecord(ReservationHomeSubCluster.class);
ReservationHomeSubCluster appMapping = Records.newRecord(ReservationHomeSubCluster.class);
appMapping.setReservationId(appId);
appMapping.setHomeSubCluster(homeSubCluster);
return appMapping;
@@ -67,11 +66,11 @@ public static ReservationHomeSubCluster newInstance(ReservationId appId,
* Set the {@link ReservationId} representing the unique identifier of the
* Reservation.
*
* @param reservationId the reservation identifier
* @param resId the reservation identifier
*/
@Private
@Unstable
public abstract void setReservationId(ReservationId reservationId);
public abstract void setReservationId(ReservationId resId);

/**
* Get the {@link SubClusterId} representing the unique identifier of the home
@@ -87,11 +86,11 @@ public static ReservationHomeSubCluster newInstance(ReservationId appId,
* Set the {@link SubClusterId} representing the unique identifier of the home
* subcluster in which the ReservationMaster of the reservation is running.
*
* @param homeSubCluster the home subcluster identifier
* @param subClusterId the home subcluster identifier
*/
@Private
@Unstable
public abstract void setHomeSubCluster(SubClusterId homeSubCluster);
public abstract void setHomeSubCluster(SubClusterId subClusterId);

@Override
public boolean equals(Object obj) {
Original file line number Diff line number Diff line change
@@ -114,17 +114,17 @@ public ReservationId getReservationId() {
return null;
}
this.reservationId = convertFromProtoFormat(p.getReservationId());
return reservationId;
return this.reservationId;
}

@Override
public void setReservationId(ReservationId reservationId) {
public void setReservationId(ReservationId resId) {
maybeInitBuilder();
if (reservationId == null) {
if (resId == null) {
builder.clearReservationId();
return;
}
this.reservationId = reservationId;
this.reservationId = resId;
}

@Override
@@ -141,12 +141,13 @@ public SubClusterId getHomeSubCluster() {
}

@Override
public void setHomeSubCluster(SubClusterId homeSubCluster) {
public void setHomeSubCluster(SubClusterId subClusterId) {
maybeInitBuilder();
if (homeSubCluster == null) {
if (subClusterId == null) {
builder.clearHomeSubCluster();
return;
}
this.homeSubCluster = homeSubCluster;
this.homeSubCluster = subClusterId;
}

private SubClusterId convertFromProtoFormat(SubClusterIdProto subClusterId) {
Original file line number Diff line number Diff line change
@@ -165,8 +165,7 @@ public void testFollowReservation() throws YarnException {
long now = Time.now();
ReservationSubmissionRequest resReq = getReservationSubmissionRequest();
when(resReq.getQueue()).thenReturn("queue1");
when(resReq.getReservationId())
.thenReturn(ReservationId.newInstance(now, 1));
when(resReq.getReservationId()).thenReturn(ReservationId.newInstance(now, 1));

FederationRouterPolicy routerPolicy = (FederationRouterPolicy) getPolicy();
FederationStateStoreFacade storeFacade =

0 comments on commit e005045

Please sign in to comment.