Skip to content

Commit

Permalink
NIFI-10139: Adding fields to RemoteProcessGroupStatus (apache#6137)
Browse files Browse the repository at this point in the history
  • Loading branch information
gresockj authored Jun 22, 2022
1 parent edd862b commit 3dda694
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -586,6 +587,13 @@ public static void merge(final ProcessGroupStatus target, final ProcessGroupStat
merged.setSentContentSize(merged.getSentContentSize() + statusToMerge.getSentContentSize());
merged.setSentCount(merged.getSentCount() + statusToMerge.getSentCount());
merged.setActiveThreadCount(merged.getActiveThreadCount() + statusToMerge.getActiveThreadCount());

// Take the earliest last refresh time
final Date mergedLastRefreshTime = merged.getLastRefreshTime();
final Date toMergeLastRefreshTime = statusToMerge.getLastRefreshTime();
if (mergedLastRefreshTime == null || (toMergeLastRefreshTime != null && toMergeLastRefreshTime.before(mergedLastRefreshTime))) {
merged.setLastRefreshTime(toMergeLastRefreshTime);
}
}

target.setRemoteProcessGroupStatus(mergedRemoteGroupMap.values());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.nifi.controller.status;

import java.util.Date;
import java.util.concurrent.TimeUnit;

/**
Expand All @@ -28,6 +29,9 @@ public class RemoteProcessGroupStatus implements Cloneable {
private TransmissionStatus transmissionStatus;
private String uri;
private String name;
private String comments;
private String authorizationIssue;
private Date lastRefreshTime;
private Integer activeThreadCount;
private int sentCount;
private long sentContentSize;
Expand Down Expand Up @@ -70,6 +74,30 @@ public void setName(String name) {
this.name = name;
}

public String getComments() {
return comments;
}

public void setComments(String comments) {
this.comments = comments;
}

public String getAuthorizationIssue() {
return authorizationIssue;
}

public void setAuthorizationIssue(String authorizationIssue) {
this.authorizationIssue = authorizationIssue;
}

public Date getLastRefreshTime() {
return lastRefreshTime;
}

public void setLastRefreshTime(Date lastRefreshTime) {
this.lastRefreshTime = lastRefreshTime;
}

public String getId() {
return id;
}
Expand Down Expand Up @@ -156,6 +184,9 @@ public RemoteProcessGroupStatus clone() {
clonedObj.id = id;
clonedObj.groupId = groupId;
clonedObj.name = name;
clonedObj.comments = comments;
clonedObj.authorizationIssue = authorizationIssue;
clonedObj.lastRefreshTime = lastRefreshTime;
clonedObj.uri = uri;
clonedObj.activeThreadCount = activeThreadCount;
clonedObj.transmissionStatus = transmissionStatus;
Expand All @@ -178,6 +209,12 @@ public String toString() {
builder.append(groupId);
builder.append(", name=");
builder.append(name);
builder.append(", comments=");
builder.append(comments);
builder.append(", authorizationIssue=");
builder.append(authorizationIssue);
builder.append(", lastRefreshTime=");
builder.append(lastRefreshTime);
builder.append(", uri=");
builder.append(uri);
builder.append(", activeThreadCount=");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ private RemoteProcessGroupStatus createRemoteGroupStatus(final RemoteProcessGrou
final RemoteProcessGroupStatus status = new RemoteProcessGroupStatus();
status.setGroupId(remoteGroup.getProcessGroup().getIdentifier());
status.setName(isRemoteProcessGroupAuthorized ? remoteGroup.getName() : remoteGroup.getIdentifier());
status.setComments(isRemoteProcessGroupAuthorized ? remoteGroup.getComments() : null);
status.setAuthorizationIssue(remoteGroup.getAuthorizationIssue());
status.setLastRefreshTime(remoteGroup.getLastRefreshTime());
status.setTargetUri(isRemoteProcessGroupAuthorized ? remoteGroup.getTargetUri() : null);

long lineageMillis = 0L;
Expand Down

0 comments on commit 3dda694

Please sign in to comment.